Software /
code /
prosody
Comparison
util/ip.lua @ 8468:5bfe58539b6c
util.ip: Convert the correct IP to IPv6-mapped for comparison (fixes traceback, possibly invalid result)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 09 Dec 2017 20:53:37 +0100 |
parent | 8441:e6e69be59233 |
child | 8469:52d48cea1f60 |
comparison
equal
deleted
inserted
replaced
8467:7269313c1324 | 8468:5bfe58539b6c |
---|---|
236 end | 236 end |
237 if ipA.proto ~= ipB.proto then | 237 if ipA.proto ~= ipB.proto then |
238 if ipA.proto == "IPv4" then | 238 if ipA.proto == "IPv4" then |
239 ipA = ipA.toV4mapped; | 239 ipA = ipA.toV4mapped; |
240 elseif ipB.proto == "IPv4" then | 240 elseif ipB.proto == "IPv4" then |
241 ipB = ipA.toV4mapped; | 241 ipB = ipB.toV4mapped; |
242 bits = bits + (128 - 32); | 242 bits = bits + (128 - 32); |
243 end | 243 end |
244 end | 244 end |
245 return ipA.bits:sub(1, bits) == ipB.bits:sub(1, bits); | 245 return ipA.bits:sub(1, bits) == ipB.bits:sub(1, bits); |
246 end | 246 end |