diff --git a/files/usr/local/bin/node-setup b/files/usr/local/bin/node-setup index 28d0f356..41bc63fb 100755 --- a/files/usr/local/bin/node-setup +++ b/files/usr/local/bin/node-setup @@ -981,6 +981,17 @@ if nixio.fs.access("/etc/config.mesh/olsrd", "r") then if is_supernode then of:write("config Hna4\n\toption netaddr 10.0.0.0\n\toption netmask 255.0.0.0\n\n") end + + if nixio.fs.stat("/etc/config.mesh/xlink") then + uci.cursor("/etc/config.mesh"):foreach("xlink", "interface", + function(section) + if section.netmask ~= "255.255.255.255" then + local addr = decimal_to_ip(nixio.bit.band(ip_to_decimal(section.ipaddr), ip_to_decimal(section.netmask))) + of:write(string.format("config Hna4\n\toption netaddr %s\n\toption netmask %s\n\n", addr, section.netmask)) + end + end + ) + end if nc:get("aredn", "@wan[0]", "olsrd_gw") == "1" then of:write("config LoadPlugin\n\toption library 'olsrd_dyn_gw.so.0.5'\n\toption Interval '60'\n\tlist Ping '8.8.8.8'\n\tlist Ping '8.8.4.4'\n\n") diff --git a/files/www/cgi-bin/advancednetwork b/files/www/cgi-bin/advancednetwork index 955a6b2d..50d3f953 100755 --- a/files/www/cgi-bin/advancednetwork +++ b/files/www/cgi-bin/advancednetwork @@ -191,6 +191,7 @@ function read_xlink_config() peer = nil, weight = 0, port = nil, + netmask = nil, mac = "" } configs[#configs + 1] = config @@ -225,6 +226,10 @@ function read_xlink_config() if m then config.weight = tonumber(m) end + m = line:match("option%s+netmask%s+'([%d%.]+)'") + if m then + config.netmask = m + end end end return configs @@ -320,8 +325,12 @@ function write_xlink_config(configs) f:write("\toption macaddr '" .. config.mac .. "'\n") f:write("\toption proto 'static'\n") f:write("\toption ipaddr '" .. config.ipaddr .. "'\n") - f:write("\toption netmask '255.255.255.255'\n") f:write("\toption weight '" .. config.weight .. "'\n") + if config.netmask and config.netmask ~= "" then + f:write("\toption netmask '" .. config.netmask .. "'\n") + else + f:write("\toption netmask '255.255.255.255'\n") + end if config.peer and config.peer ~= "" then f:write("\toption peer '" .. config.peer .. "'\n") f:write("\nconfig route\n") @@ -512,13 +521,10 @@ html.print([[ width: 100px; padding-left: 10px; } - .xlinks td:nth-child(1), .xlinks td:nth-child(4) { + .xlinks td:nth-child(1), .xlinks td:nth-child(4), .xlinks td:nth-child(5) { width: 40px; } - .xlinks td:nth-child(5) { - width: 55px; - } - .xlinks td:nth-child(6) { + .xlinks td:nth-child(6), .xlinks td:nth-child(7) { width: 20px; } .xlinks td input { @@ -531,7 +537,7 @@ html.print([[ .xlinks td:nth-child(1) input, .xlinks td:nth-child(4) input { text-align: right; } - .xlinks td:nth-child(6) button { + .xlinks td:nth-child(7) button { width: 24px; line-height: 14px; background-color: #f0f0f0; @@ -596,6 +602,7 @@ html.print([[ const row = document.createElement("tr"); row.innerHTML = "
vlan | ip address | peer address | weight | ]]) if #layout.ports > 1 then - html.print([[Port | ]]) + html.print([[port | ]]) +else + html.print([[ ]]) end +html.print([[cidr | ]]) html.print([[") html.print(" | ") html.print("") end |