- if v.proto == '4' then
- uci:foreach("network", "interface",function(vif)
- if vif.ipaddr and vif.ipaddr == v.localIP then
- interface = vif['.name'] or vif.interface
- lmac = string.lower(vif.macaddr or "")
- return
- end
- end)
- for _, arpt in ipairs(arptable) do
- ip = arpt['IP address']
- if ip == v.remoteIP then
- rmac = string.lower(arpt['HW address'] or "")
- end
- end
- elseif v.proto == '6' then
- uci:foreach("network", "interface",function(vif)
- local name = vif['.name']
- local net = ntm:get_network(name)
- local device = net and net:get_interface()
- local locip = ipc.IPv6(v.localIP)
- if device and device:ip6addrs() and locip then
- for _, a in ipairs(device:ip6addrs()) do
- if not a:is6linklocal() then
- if a:host() == locip:host() then
- interface = name
- --neihgt = neightbl.get(device.ifname) or {}
- end
- end
- end
- end
- end)
- --[[
- for ip,mac in pairs(neihgt) do
- if ip == v.remoteIP then
- rmac = mac
- end
- end
- ]]--
- end
+
+ local interface = ntm:get_status_by_address(v.localIP)
+ local lmac = local_mac_lookup(v.localIP)
+ local rmac = remote_mac_lookup(v.remoteIP)
+