From ff4432ad3826aa3940e0d888d93d26f5bc70bed7 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Sat, 8 Sep 2018 08:34:32 +0200 Subject: [PATCH] interfaces: real fix for #2698 We create state files for the "real" interfaces in IPv4, so we need to apply the same logic to IPv6. 6RD and 6TO4 do not seem to do this yet so bring them over. --- src/etc/inc/interfaces.inc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index f866e76dc..089435aff 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -1110,6 +1110,7 @@ function interface_bring_down($interface = "wan", $ifacecfg = false) mwexecf('/sbin/pfctl -i %s -Fs', $dev); } + /* clear stale state files associated with this interface */ @unlink("/var/db/{$interface}_ip"); @unlink("/var/db/{$interface}_ipv6"); @unlink("/var/db/{$interface}_cacheip"); @@ -1122,6 +1123,8 @@ function interface_bring_down($interface = "wan", $ifacecfg = false) @unlink("/tmp/{$realifv6}upv6"); @unlink("/tmp/{$realif}_router"); @unlink("/tmp/{$realifv6}_routerv6"); + @unlink("/tmp/{$realif}_defaultgw"); + @unlink("/tmp/{$realifv6}_defaultgwv6"); } function interfaces_ptpid_used($ptpid) @@ -2726,8 +2729,8 @@ function interface_6rd_configure($interface = 'wan', $wancfg) mwexecf('/sbin/ifconfig %s stfv4br %s', array($stfiface, $wancfg['gateway-6rd'])); mwexecf('/sbin/ifconfig %s stfv4net %s/%s', array($stfiface, $ip4address, $wancfg['prefix-6rd-v4plen'])); - file_put_contents("/tmp/{$wanif}_routerv6", "{$rd6brgw}\n"); - file_put_contents("/tmp/{$wanif}_defaultgwv6", "{$rd6brgw}\n"); + file_put_contents("/tmp/{$stfiface}_routerv6", "{$rd6brgw}\n"); + file_put_contents("/tmp/{$stfiface}_defaultgwv6", "{$rd6brgw}\n"); $ip4gateway = get_interface_gateway($interface); if (is_ipaddrv4($ip4gateway)) { @@ -2824,9 +2827,8 @@ function interface_6to4_configure($interface = 'wan', $wancfg) mwexecf('/sbin/ifconfig %s inet6 %s prefixlen 16', array($stfiface, $stflanpr)); - /* write out a default router file */ - file_put_contents("/tmp/{$wanif}_routerv6", "{$stfbrgw}"); - file_put_contents("/tmp/{$wanif}_defaultgwv6", "{$stfbrgw}"); + file_put_contents("/tmp/{$stfiface}_routerv6", "{$stfbrgw}"); + file_put_contents("/tmp/{$stfiface}_defaultgwv6", "{$stfbrgw}"); $ip4gateway = get_interface_gateway($interface); if (is_ipaddrv4($ip4gateway)) {