Fix DTD and WLAN ips derived from matching MACs. (#1128)

On some devices the hardware MAC for the WLAN and ETH are the
same so the 10.DTD and 10.WLAN addresses are identical. If we
detect this, bump the DTD address.
Commonly seen on TP-Link devices (but there are others)
This commit is contained in:
Tim Wilkinson 2024-03-26 22:56:21 -07:00 committed by GitHub
parent a14b897e0f
commit 3d1faf8939
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -119,5 +119,13 @@ end
if dtdmac == "" then if dtdmac == "" then
local a, b, c = aredn.hardware.get_interface_mac(aredn.hardware.get_iface_name("lan")):match("%w%w:%w%w:%w%w:(%w%w):(%w%w):(%w%w)") local a, b, c = aredn.hardware.get_interface_mac(aredn.hardware.get_iface_name("lan")):match("%w%w:%w%w:%w%w:(%w%w):(%w%w):(%w%w)")
aredn_info.set_nvram("dtdmac", string.format("%d.%d.%d", tonumber(a, 16), tonumber(b, 16), tonumber(c, 16))) dtdmac = string.format("%d.%d.%d", tonumber(a, 16), tonumber(b, 16), tonumber(c, 16))
if dtdmac == mac2 then
a = tonumber(a, 16) + 1
if a > 255 then
a = 0
end
dtdmac = string.format("%d.%d.%d", a, tonumber(b, 16), tonumber(c, 16))
end
aredn_info.set_nvram("dtdmac", dtdmac)
end end