Fix and harminize the way tunnel IPs wrap (and avoid using 256 as an octet) (#1315)

This commit is contained in:
Tim Wilkinson 2024-08-18 18:01:55 -07:00 committed by GitHub
parent bac75d6df3
commit 00a5cca7b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -156,6 +156,9 @@ for (let i = 0; i < 62; i++) {
l[3] += 4;
if (l[3] >= 252) {
l[2]++;
if (l[2] === 256) {
l[2] = 0;
}
l[3] = 4;
}
}
@ -165,6 +168,9 @@ for (let i = 0; i < 126; i++) {
w[3] += 2;
if (w[3] >= 254) {
w[2]++;
if (w[2] === 256) {
w[2] = 0;
}
w[3] = 2;
}
p++;

View File

@ -650,6 +650,9 @@ if not is_new_supernode then
local net
if netw[4] + cnum * 4 > 252 then
netw[3] = netw[3] + 1
if netw[3] == 256 then
netw[3] = 0
end
netw[4] = 0
net = 0
cnum = 0