1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Add IPv6 checkbox for interface in wizard and fix modemmanager support

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-02-15 15:35:04 +01:00
parent 3112e3c28d
commit 9152cfc85f
3 changed files with 28 additions and 11 deletions

View file

@ -240,6 +240,7 @@ function wizard_add()
local netmask = luci.http.formvalue("cbid.network.%s.netmask" % intf) or "" local netmask = luci.http.formvalue("cbid.network.%s.netmask" % intf) or ""
local gateway = luci.http.formvalue("cbid.network.%s.gateway" % intf) or "" local gateway = luci.http.formvalue("cbid.network.%s.gateway" % intf) or ""
local ip6gw = luci.http.formvalue("cbid.network.%s.ip6gw" % intf) or "" local ip6gw = luci.http.formvalue("cbid.network.%s.ip6gw" % intf) or ""
local ipv6 = luci.http.formvalue("cbid.network.%s.ipv6" % intf) or "0"
local apn = luci.http.formvalue("cbid.network.%s.apn" % intf) or "" local apn = luci.http.formvalue("cbid.network.%s.apn" % intf) or ""
local pincode = luci.http.formvalue("cbid.network.%s.pincode" % intf) or "" local pincode = luci.http.formvalue("cbid.network.%s.pincode" % intf) or ""
local delay = luci.http.formvalue("cbid.network.%s.delay" % intf) or "" local delay = luci.http.formvalue("cbid.network.%s.delay" % intf) or ""
@ -282,6 +283,7 @@ function wizard_add()
ucic:set("network",intf,"auth",auth) ucic:set("network",intf,"auth",auth)
ucic:set("network",intf,"mode",mode) ucic:set("network",intf,"mode",mode)
ucic:set("network",intf,"label",label) ucic:set("network",intf,"label",label)
ucic:set("network",intf,"ipv6",ipv6)
if lan == "1" then if lan == "1" then
ucic:set("network",intf,"multipath","off") ucic:set("network",intf,"multipath","off")
else else
@ -1077,7 +1079,13 @@ end
function get_device(interface) function get_device(interface)
local dump = require("luci.util").ubus("network.interface.%s" % interface, "status", {}) local dump = require("luci.util").ubus("network.interface.%s" % interface, "status", {})
if dump ~= nil then if dump ~= nil then
if dump['l3_device'] ~= nil then
return dump['l3_device'] return dump['l3_device']
elseif dump['device'] ~= nil then
return dump['device']
else
return ""
end
else else
return "" return ""
end end

View file

@ -561,6 +561,7 @@
<% <%
iffind=0 iffind=0
uciifname=uci:get("network",ifname,"ifname") uciifname=uci:get("network",ifname,"ifname")
if uciifname ~= nil then
if uciifname:match("/") then if uciifname:match("/") then
realifname=uciifname realifname=uciifname
vlan="" vlan=""
@ -568,6 +569,7 @@
realifname=splitstring(uciifname,'.')[1] or "" realifname=splitstring(uciifname,'.')[1] or ""
vlan=splitstring(uciifname,'.')[2] or "" vlan=splitstring(uciifname,'.')[2] or ""
end end
end
for _, ifacea in ipairs(ifaces) do for _, ifacea in ipairs(ifaces) do
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) and device_notvirtual(ifacea) then if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) and device_notvirtual(ifacea) then
%> %>
@ -671,6 +673,13 @@
<% <%
end end
%> %>
<div class="cbi-value" id="cbi-network-<%=ifname%>-ip6" data-depends="[{&#34;enableipv6&#34;:&#34;0&#34;,&#34;cbid.network.<%=ifname%>.proto&#34;:&#34;static&#34;}]" data-index="10">
<label class="cbi-value-title"><%:Accept IPv6 RA%></label>
<div class="cbi-value-field">
<input type="checkbox" id="cbid.network.<%=ifname%>.ipv6" name="cbid.network.<%=ifname%>.ipv6" value="1" <% if uci:get("network",ifname,"ipv6") == "1" then %>checked<% end %> />
</div>
</div>
<div class="cbi-value" id="cbi-network-<%=ifname%>-device-ncm" data-depends="[{&#34;cbid.network.<%=ifname%>.proto&#34;:&#34;ncm&#34;}]" data-index="5"> <div class="cbi-value" id="cbi-network-<%=ifname%>-device-ncm" data-depends="[{&#34;cbid.network.<%=ifname%>.proto&#34;:&#34;ncm&#34;}]" data-index="5">
<label class="cbi-value-title"><%:Device%></label> <label class="cbi-value-title"><%:Device%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">

View file

@ -60,25 +60,25 @@ omr_set_settings() {
config_get device "$1" device config_get device "$1" device
config_get proto "$1" proto config_get proto "$1" proto
config_get type "$1" type config_get type "$1" type
config_get ipv6 "$1" ipv6
config_get addlatency "$1" addlatency config_get addlatency "$1" addlatency
[ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "omrvpn" ] && [ "$1" != "glorytun" ] && return [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "omrvpn" ] && [ "$1" != "glorytun" ] && return
uci -q set openmptcprouter.$1=interface uci -q set openmptcprouter.$1=interface
uci -q set openmptcprouter.$1.multipath="$multipath" uci -q set openmptcprouter.$1.multipath="$multipath"
config_get disable_ipv6 settings disable_ipv6 "0" config_get disable_ipv6 settings disable_ipv6 "0"
if [ "$proto" != "dhcpv6" ] && ([ "$disable_ipv6" = "1" ] || [ "$1" != "omr6in4" ]); then if [ "$disable_ipv6" = "1" ]; then
uci -q set network.$1.ipv6=0 uci -q set network.$1.ipv6=0
else
uci -q set network.$1.ipv6=1
fi fi
[ -z "$addlatency" ] && addlatency=0 [ -z "$addlatency" ] && addlatency=0
devicename=$(echo "$device" | cut -d'/' -f3) devicename=$(echo "$device" | cut -d'/' -f3)
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') [ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
[ -n "$(echo $ifname | grep '@')" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
if [ -n "$ifname" ]; then if [ -n "$ifname" ]; then
if [ "$proto" = "dhcpv6" ]; then if [ "$proto" = "dhcpv6" ] || [ "$ipv6" = "1" ]; then
# Change interface name for sysctl in case of VLAN (eth0.2 => eth0/2) # Change interface name for sysctl in case of VLAN (eth0.2 => eth0/2)
ifnamesys=$(echo $ifname | sed 's:\.:/:') ifnamesys=$(echo $ifname | sed 's:\.:/:')
sysctl -qw net.ipv6.conf.${ifnamesys}.disable_ipv6=0 sysctl -qw net.ipv6.conf.${ifnamesys}.disable_ipv6=0