diff --git a/package/gluon-web-network/i18n/de.po b/package/gluon-web-network/i18n/de.po index 4a6bc8b5edca5325499baf4b07af818c37c2f4e9..77b3a6a3509edd72307bd85a3f1151f220ec39d6 100644 --- a/package/gluon-web-network/i18n/de.po +++ b/package/gluon-web-network/i18n/de.po @@ -28,6 +28,9 @@ msgstr "PoE-Passthrough aktivieren" msgid "Enable PoE Power Port %s" msgstr "PoE-Ausgabe auf Port %s aktivieren" +msgid "Enable meshing on the Ethernet interface" +msgstr "Mesh auf dem Ethernet-Port aktivieren" + msgid "Enable meshing on the LAN interface" msgstr "Mesh auf dem LAN-Port aktivieren" diff --git a/package/gluon-web-network/i18n/fr.po b/package/gluon-web-network/i18n/fr.po index 292d6e25bca8fa09e3e153e8418a14a989543c6e..97067343dfb86425f88d325ae634567ca35179d1 100644 --- a/package/gluon-web-network/i18n/fr.po +++ b/package/gluon-web-network/i18n/fr.po @@ -28,6 +28,9 @@ msgstr "" msgid "Enable PoE Power Port %s" msgstr "" +msgid "Enable meshing on the Ethernet interface" +msgstr "" + msgid "Enable meshing on the LAN interface" msgstr "Activer le réseau MESH sur le port LAN" diff --git a/package/gluon-web-network/i18n/gluon-web-network.pot b/package/gluon-web-network/i18n/gluon-web-network.pot index 913b78b3a7310af42cd391b9e7b2c2fdd80d6d2f..a75929dfe6c1f08b18128cb1028f5c1c57c395ea 100644 --- a/package/gluon-web-network/i18n/gluon-web-network.pot +++ b/package/gluon-web-network/i18n/gluon-web-network.pot @@ -19,6 +19,9 @@ msgstr "" msgid "Enable PoE Power Port %s" msgstr "" +msgid "Enable meshing on the Ethernet interface" +msgstr "" + msgid "Enable meshing on the LAN interface" msgstr "" diff --git a/package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua b/package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua index dab31ec014d745be31ac55ec4660e30322e04b9a..df92c965902b68b2551fd6403ed5927ea6264e08 100644 --- a/package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua +++ b/package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua @@ -76,36 +76,37 @@ end s = f:section(Section) -local mesh_wan = s:option(Flag, "mesh_wan", translate("Enable meshing on the WAN interface")) -mesh_wan.default = not uci:get_bool("network", "mesh_wan", "disabled") - -function mesh_wan:write(data) - uci:set("network", "mesh_wan", "disabled", not data) -end - -if sysconfig.lan_ifname then - s = f:section(Section) - - local mesh_lan = s:option(Flag, "mesh_lan", translate("Enable meshing on the LAN interface")) - mesh_lan.default = not uci:get_bool("network", "mesh_lan", "disabled") - - function mesh_lan:write(data) - uci:set("network", "mesh_lan", "disabled", not data) - - local interfaces = uci:get_list("network", "client", "ifname") - - for lanif in sysconfig.lan_ifname:gmatch('%S+') do - if data then - util.remove_from_set(interfaces, lanif) - else - util.add_to_set(interfaces, lanif) - end +local wired_mesh_help = { + single = translate('Enable meshing on the Ethernet interface'), + wan = translate('Enable meshing on the WAN interface'), + lan = translate('Enable meshing on the LAN interface'), +} + +local function wired_mesh(iface) + if not sysconfig[iface .. '_ifname'] then return end + local iface_roles = uci:get_list('gluon', 'iface_' .. iface, 'role') + + local option = s:option(Flag, 'mesh_' .. iface, wired_mesh_help[iface]) + option.default = util.contains(iface_roles, 'mesh') ~= false + + function option:write(data) + local roles = uci:get_list('gluon', 'iface_' .. iface, 'role') + if data then + util.add_to_set(roles, 'mesh') + else + util.remove_from_set(roles, 'mesh') end + uci:set_list('gluon', 'iface_' .. iface, 'role', roles) - uci:set_list("network", "client", "ifname", interfaces) + -- Reconfigure on next reboot + uci:set('gluon', 'core', 'reconfigure', true) end end +wired_mesh('single') +wired_mesh('wan') +wired_mesh('lan') + local section uci:foreach("system", "gpio_switch", function(si) if si[".name"]:match("poe") then @@ -160,7 +161,7 @@ function f:write() uci:delete("network", "wan6", "ip6gw") end - + uci:commit('gluon') uci:commit("network") uci:commit('system') end