Explorar el Código

gluon-core: restructure WAN configuration

Matthias Schiffer hace 10 años
padre
commit
3762f52c69

+ 0 - 10
package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network

@@ -1,19 +1,9 @@
 #!/usr/bin/lua
 
-local sysconfig = require 'gluon.sysconfig'
 local uci = require('luci.model.uci').cursor()
 
-
 uci:delete('network', 'lan')
 uci:delete('network', 'wan')
 
-uci:section('network', 'interface', 'wan',
-	    {
-	       ifname = sysconfig.wan_ifname,
-	       type = 'bridge',
-	       proto = 'dhcp',
-	    }
-)
-
 uci:save('network')
 uci:commit('network')

+ 22 - 10
package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network

@@ -2,22 +2,34 @@
 
 local uci = require('luci.model.uci').cursor()
 local sysctl = require 'gluon.sysctl'
+local sysconfig = require 'gluon.sysconfig'
 
 
-if not uci:get('network', 'interface', 'wan6') then
-   uci:section('network', 'interface', 'wan6',
-	       {
-		  ifname = 'br-wan',
-		  proto = 'dhcpv6',
-	       }
-   )
+uci:section('network', 'interface', 'wan',
+	    {
+	      ifname = sysconfig.wan_ifname,
+	      type = 'bridge',
+	      peerdns = 0,
+	      auto = 1,
+	    }
+)
+
+if not uci:get('network', 'wan', 'proto') then
+  uci:set('network', 'wan', 'proto', 'dhcp')
 end
 
 
-uci:set('network', 'wan', 'peerdns', '0')
+uci:section('network', 'interface', 'wan6',
+	    {
+	      ifname = 'br-wan',
+	      peerdns = 0,
+	      ip6table = 1,
+	    }
+)
 
-uci:set('network', 'wan6', 'peerdns', '0')
-uci:set('network', 'wan6', 'ip6table', '1')
+if not uci:get('network', 'wan6', 'proto') then
+  uci:set('network', 'wan6', 'proto', 'dhcpv6')
+end
 
 
 uci:section('network', 'rule6', 'wan6_lookup',