applications/siitwizard: lower mtu on lan and wan to 1240, make sure to remove old...
[project/luci.git] / applications / luci-siitwizard / luasrc / model / cbi / siitwizard.lua
index 12d9ff9..3603d6e 100644 (file)
@@ -65,7 +65,7 @@ f = SimpleForm("siitwizward", "SIIT-Wizzard",
 f:field(DummyValue, "info_ula", "Mesh ULA address").value = ula:string()
 
 f:field(DummyValue, "ipv4_pool", "IPv4 allocation pool").value =
-       "%s (%i hosts)" %{ gv4_net:string(), 2 ^ gv4_net:prefix() - 2 }
+       "%s (%i hosts)" %{ gv4_net:string(), 2 ^ ( 32 - gv4_net:prefix() ) - 2 }
 
 f:field(DummyValue, "ipv4_size", "IPv4 LAN network prefix").value =
        "%i bit (%i hosts)" %{ ipv4_netsz, 2 ^ ( 32 - ipv4_netsz ) - 2 }
@@ -161,6 +161,8 @@ function mode.write(self, section, value)
        uci:section("wireless", "wifi-iface", nil, {
                encryption = "none",
                mode       = "adhoc",
+               txpower    = 10,
+               sw_merge   = 1,
                network    = wifi_device,
                device     = wifi_device,
                ssid       = wifi_essid,
@@ -180,13 +182,14 @@ function mode.write(self, section, value)
        if value == "gateway" then
 
                -- wan mtu
-               uci:set("network", "wan", "mtu", 1400)
+               uci:set("network", "wan", "mtu", 1240)
 
                -- lan settings
                uci:tset("network", "lan", {
-                       mtu     = 1400,
+                       mtu     = 1240,
                        ipaddr  = lan_net:host():string(),
-                       netmask = lan_net:mask():string()
+                       netmask = lan_net:mask():string(),
+                       proto   = "static"
                })
 
                -- use full siit subnet
@@ -214,7 +217,7 @@ function mode.write(self, section, value)
 
                -- lan settings
                uci:tset("network", "lan", {
-                       mtu     = 1400,
+                       mtu     = 1240,
                        ipaddr  = lan_net:host():string(),
                        netmask = lan_net:mask():string()
                })
@@ -339,11 +342,7 @@ function mode.write(self, section, value)
 
        -- hna6
        uci:delete_all("olsrd", "Hna6",
-               function(s)
-                       if s.netaddr and s.prefix then
-                               return siit_route:contains(luci.ip.IPv6(s.netaddr.."/"..s.prefix))
-                       end
-               end)
+               function(s) return true end)
 
        uci:section("olsrd", "Hna6", nil, {
                netaddr = siit_route:host():string(),
@@ -362,7 +361,9 @@ function mode.write(self, section, value)
 
        -- lan dns
        uci:tset("dhcp", "lan", {
-               dhcp_option = "6," .. dns_server
+               dhcp_option = "6," .. dns_server,
+               start       = bit.band(lan_net:minhost():add(1)[2][2], 0xFF),
+               limit       = ( 2 ^ ( 32 - lan_net:prefix() ) ) - 3
        })
 
        -- hostname