Merge 2fb3f9c8ae
into d952e124f0
This commit is contained in:
commit
4eea29fc17
|
@ -13,12 +13,13 @@ $Id$
|
|||
]]--
|
||||
|
||||
local uci = luci.model.uci.cursor()
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
|
||||
local wan = uci:get_all("network", "wan")
|
||||
local wan6 = uci:get_all("network", "wan6")
|
||||
local dns = uci:get_first("gluon-wan-dnsmasq", "static")
|
||||
|
||||
local f = SimpleForm("portconfig", "WAN-Verbindung")
|
||||
local f = SimpleForm("portconfig")
|
||||
f.template = "admin/expertmode"
|
||||
f.submit = "Speichern"
|
||||
f.reset = "Zurücksetzen"
|
||||
|
@ -26,7 +27,7 @@ f.reset = "Zurücksetzen"
|
|||
local s
|
||||
local o
|
||||
|
||||
s = f:section(SimpleSection, nil, nil)
|
||||
s = f:section(SimpleSection, "WAN-Verbindung", nil)
|
||||
|
||||
o = s:option(ListValue, "ipv4", "IPv4")
|
||||
o:value("dhcp", "Automatisch (DHCP)")
|
||||
|
@ -52,9 +53,6 @@ o.value = wan.gateway
|
|||
o.datatype = "ip4addr"
|
||||
o.rmempty = false
|
||||
|
||||
|
||||
s = f:section(SimpleSection, nil, nil)
|
||||
|
||||
o = s:option(ListValue, "ipv6", "IPv6")
|
||||
o:value("dhcpv6", "Automatisch (RA/DHCPv6)")
|
||||
o:value("static", "Statisch")
|
||||
|
@ -73,21 +71,25 @@ o.value = wan6.ip6gw
|
|||
o.datatype = "ip6addr"
|
||||
o.rmempty = false
|
||||
|
||||
|
||||
if dns then
|
||||
s = f:section(SimpleSection, nil, nil)
|
||||
|
||||
o = s:option(DynamicList, "dns", "Statische DNS-Server")
|
||||
o:write(nil, uci:get("gluon-wan-dnsmasq", dns, "server"))
|
||||
o.datatype = "ipaddr"
|
||||
end
|
||||
|
||||
s = f:section(SimpleSection, nil, nil)
|
||||
s = f:section(SimpleSection, "Meshing", nil)
|
||||
|
||||
o = s:option(Flag, "mesh_wan", "Mesh auf dem WAN-Port aktivieren")
|
||||
o.default = uci:get_bool("network", "mesh_wan", "auto") and o.enabled or o.disabled
|
||||
o.rmempty = false
|
||||
|
||||
if sysconfig.lan_ifname then
|
||||
o = s:option(Flag, "mesh_lan", "Mesh auf den LAN-Ports aktivieren")
|
||||
o.default = uci:get_bool("network", "mesh_lan", "auto") and o.enabled or o.disabled
|
||||
o.rmempty = false
|
||||
end
|
||||
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
uci:set("network", "wan", "proto", data.ipv4)
|
||||
|
@ -112,6 +114,16 @@ function f.handle(self, state, data)
|
|||
|
||||
uci:set("network", "mesh_wan", "auto", data.mesh_wan)
|
||||
|
||||
if sysconfig.lan_ifname then
|
||||
uci:set("network", "mesh_lan", "auto", data.mesh_lan)
|
||||
|
||||
if data.mesh_lan == '1' then
|
||||
uci:set("network", "client", "ifname", "bat0")
|
||||
else
|
||||
uci:set("network", "client", "ifname", sysconfig.lan_ifname .. " bat0")
|
||||
end
|
||||
end
|
||||
|
||||
uci:save("network")
|
||||
uci:commit("network")
|
||||
|
||||
|
|
|
@ -11,3 +11,4 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do
|
|||
end
|
||||
|
||||
need_boolean('mesh_on_wan', false)
|
||||
need_boolean('mesh_on_lan', false)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local util = require 'gluon.util'
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local uci = require 'luci.model.uci'
|
||||
|
||||
local c = uci.cursor()
|
||||
|
||||
if sysconfig.lan_ifname then
|
||||
c:section('network', 'interface', 'mesh_lan',
|
||||
{ ifname = sysconfig.lan_ifname
|
||||
, proto = 'batadv'
|
||||
, mesh = 'bat0'
|
||||
, macaddr = util.generate_mac(1, 1)
|
||||
, auto = site.mesh_on_lan and 1 or 0
|
||||
})
|
||||
|
||||
c:save('network')
|
||||
c:commit('network')
|
||||
end
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local sysctl = require 'gluon.sysctl'
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require('luci.model.uci').cursor()
|
||||
|
||||
|
||||
|
@ -20,7 +21,7 @@ uci:commit('batman-adv')
|
|||
if not uci:get('network', 'client') then
|
||||
local ifname
|
||||
|
||||
if sysconfig.lan_ifname then
|
||||
if sysconfig.lan_ifname and not site.mesh_on_lan then
|
||||
ifname = sysconfig.lan_ifname .. ' bat0'
|
||||
else
|
||||
ifname = 'bat0'
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/lua
|
||||
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local uci = require 'luci.model.uci'
|
||||
|
||||
local c = uci.cursor()
|
||||
|
||||
if sysconfig.lan_ifname then
|
||||
if not c:get('network', 'mesh_lan') then
|
||||
c:section('network', 'interface', 'mesh_lan',
|
||||
{ ifname = sysconfig.lan_ifname
|
||||
, proto = 'batadv'
|
||||
, mesh = 'bat0'
|
||||
, auto = 0
|
||||
})
|
||||
end
|
||||
|
||||
c:save('network')
|
||||
c:commit('network')
|
||||
end
|
Loading…
Reference in New Issue