Loading hoodselector/luasrc/usr/sbin/hoodselector +21 −8 Original line number Diff line number Diff line Loading @@ -743,8 +743,11 @@ local function mesh_lan_wan(iface) return false end -- Get BSSID from neigbour hoods over respondd local function molw_get_bssid(iface) local neigbour_bssids = {} -- differentiate between VPN and mesh only routers local vpn_router_neigbour_bssids = {} local mesh_router_neigbour_bssids = {} for _,respondd_if in ipairs(iface) do local respondd = string.format("gluon-neighbour-info -i " .. respondd_if .. " -p 1001 -d ff02::2 -r hoodselector -t 0.5") print(respondd) Loading @@ -752,26 +755,26 @@ local function molw_get_bssid(iface) local obj, _, err = json.parse (line, 1, nil) if err then io.stderr:write("json parse error!\n") return nil else if obj["hoodinfo"] ~= nil then if obj["hoodinfo"]["vpnrouter"]:match("true") then if obj["selectedbssid"] ~= nil then if obj["selectedbssid"]["bssid"] ~= nil then if not neigbour_bssids[obj["selectedbssid"]["bssid"]] then neigbour_bssids[obj["selectedbssid"]["bssid"]] = 2 if not vpn_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] then vpn_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] = 1 else neigbour_bssids[obj["selectedbssid"]["bssid"]] = neigbour_bssids[obj["selectedbssid"]["bssid"]] + 2 vpn_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] = vpn_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] + 1 end end end else if obj["selectedbssid"] ~= nil then if obj["selectedbssid"]["bssid"] ~= nil then if not neigbour_bssids[obj["selectedbssid"]["bssid"]] then neigbour_bssids[obj["selectedbssid"]["bssid"]] = 1 if not mesh_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] then mesh_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] = 1 else neigbour_bssids[obj["selectedbssid"]["bssid"]] = neigbour_bssids[obj["selectedbssid"]["bssid"]] + 1 mesh_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] = mesh_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] + 1 end end end end Loading @@ -779,6 +782,16 @@ local function molw_get_bssid(iface) end end end local neigbour_bssids if next(vpn_router_neigbour_bssids) then -- molwm VPN router founds. print("Found VPN routers over mesh on lan or wan") neigbour_bssids = vpn_router_neigbour_bssids else -- molwm VPN router not founds. Get most presented bssid print("No VPN routers over mesh on lan or wan") neigbour_bssids = mesh_router_neigbour_bssids end local bssid = nil Loading Loading
hoodselector/luasrc/usr/sbin/hoodselector +21 −8 Original line number Diff line number Diff line Loading @@ -743,8 +743,11 @@ local function mesh_lan_wan(iface) return false end -- Get BSSID from neigbour hoods over respondd local function molw_get_bssid(iface) local neigbour_bssids = {} -- differentiate between VPN and mesh only routers local vpn_router_neigbour_bssids = {} local mesh_router_neigbour_bssids = {} for _,respondd_if in ipairs(iface) do local respondd = string.format("gluon-neighbour-info -i " .. respondd_if .. " -p 1001 -d ff02::2 -r hoodselector -t 0.5") print(respondd) Loading @@ -752,26 +755,26 @@ local function molw_get_bssid(iface) local obj, _, err = json.parse (line, 1, nil) if err then io.stderr:write("json parse error!\n") return nil else if obj["hoodinfo"] ~= nil then if obj["hoodinfo"]["vpnrouter"]:match("true") then if obj["selectedbssid"] ~= nil then if obj["selectedbssid"]["bssid"] ~= nil then if not neigbour_bssids[obj["selectedbssid"]["bssid"]] then neigbour_bssids[obj["selectedbssid"]["bssid"]] = 2 if not vpn_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] then vpn_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] = 1 else neigbour_bssids[obj["selectedbssid"]["bssid"]] = neigbour_bssids[obj["selectedbssid"]["bssid"]] + 2 vpn_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] = vpn_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] + 1 end end end else if obj["selectedbssid"] ~= nil then if obj["selectedbssid"]["bssid"] ~= nil then if not neigbour_bssids[obj["selectedbssid"]["bssid"]] then neigbour_bssids[obj["selectedbssid"]["bssid"]] = 1 if not mesh_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] then mesh_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] = 1 else neigbour_bssids[obj["selectedbssid"]["bssid"]] = neigbour_bssids[obj["selectedbssid"]["bssid"]] + 1 mesh_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] = mesh_router_neigbour_bssids[obj["selectedbssid"]["bssid"]] + 1 end end end end Loading @@ -779,6 +782,16 @@ local function molw_get_bssid(iface) end end end local neigbour_bssids if next(vpn_router_neigbour_bssids) then -- molwm VPN router founds. print("Found VPN routers over mesh on lan or wan") neigbour_bssids = vpn_router_neigbour_bssids else -- molwm VPN router not founds. Get most presented bssid print("No VPN routers over mesh on lan or wan") neigbour_bssids = mesh_router_neigbour_bssids end local bssid = nil Loading