From 61b651cd4257b61e44840408f9856185c1bba24c Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 12 Feb 2021 15:01:56 +0100 Subject: [PATCH] Fix IPv6 for wan in wizard --- .../luasrc/controller/openmptcprouter.lua | 4 +++- .../root/etc/init.d/openmptcprouter | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 453b69479..f9e130e76 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -309,7 +309,9 @@ function wizard_add() if proto == "dhcpv6" then ucic:set("network",intf,"reqaddress","try") - ucic:set("network",intf,"reqprefix","auto") + ucic:set("network",intf,"reqprefix","no") + ucic:set("network",intf,"iface_map","0") + ucic:set("network",intf,"ipv6","1") end ucic:delete("openmptcprouter",intf,"lc") diff --git a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter index decb1fdcc..73655b167 100755 --- a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter +++ b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter @@ -1,5 +1,5 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2018 Ycarus (Yannick Chabanois) +# Copyright (C) 2018-2021 Ycarus (Yannick Chabanois) for OpenMPTCProuter # Released under GPL 3. See LICENSE for the full terms. START=5 @@ -66,7 +66,7 @@ omr_set_settings() { uci -q set openmptcprouter.$1=interface uci -q set openmptcprouter.$1.multipath="$multipath" config_get disable_ipv6 settings disable_ipv6 "0" - if [ "$disable_ipv6" = "1" ] || [ "$1" != "omr6in4" ]; then + if [ "$proto" != "dhcpv6" ] && ([ "$disable_ipv6" = "1" ] || [ "$1" != "omr6in4" ]); then uci -q set network.$1.ipv6=0 else uci -q set network.$1.ipv6=1 @@ -78,6 +78,13 @@ omr_set_settings() { [ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') if [ -n "$ifname" ]; then + if [ "$proto" = "dhcpv6" ]; then + # Change interface name for sysctl in case of VLAN (eth0.2 => eth0/2) + ifnamesys=$(echo $ifname | sed 's:\.:/:') + sysctl -qw net.ipv6.conf.${ifnamesys}.disable_ipv6=0 + sysctl -qw net.ipv6.conf.${ifnamesys}.accept_ra=1 + fi + if [ "$addlatency" = "0" ] && [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then tc qdisc del dev ${ifname} root netem fi