Mercurial > prosody-hg
comparison util/ip.lua @ 11649:aa119de5f6c7 0.11
util.ip: Fix netmask for link-local address range
This may have mistakenly caused link-local addresses to be considered
global. May have caused mod_s2s and prosodyctl check dns to behave
incorrectly on networks using link-local IPv4 addresses. By my
guesstimate, these are extremely rare. Probably minimal impact beyond
a bit longer to establish s2s and some possible confusion from
prosodyctl check dns results.
Ref RFC 3927
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 03 Jul 2021 03:27:57 +0200 |
| parents | c74c89a96cbf |
| children | a227bc35771e |
comparison
equal
deleted
inserted
replaced
| 11586:35e880501efd | 11649:aa119de5f6c7 |
|---|---|
| 98 local ipv6mapped = new_ip("::ffff:0:0"); | 98 local ipv6mapped = new_ip("::ffff:0:0"); |
| 99 | 99 |
| 100 local function v4scope(ip) | 100 local function v4scope(ip) |
| 101 if match(ip, loopback4, 8) then | 101 if match(ip, loopback4, 8) then |
| 102 return 0x2; | 102 return 0x2; |
| 103 elseif match(ip, linklocal4) then | 103 elseif match(ip, linklocal4, 16) then |
| 104 return 0x2; | 104 return 0x2; |
| 105 else -- Global unicast | 105 else -- Global unicast |
| 106 return 0xE; | 106 return 0xE; |
| 107 end | 107 end |
| 108 end | 108 end |
