diff options
author | Chris Buechler <cmb@pfsense.org> | 2015-03-05 23:49:14 -0600 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2015-03-05 23:51:07 -0600 |
commit | c0e5ab96e7bf77f1146f4df786a048e05a2eb5a2 (patch) | |
tree | 6c30f59eaaa4166423cd4562cff3dc469e57f73b /etc/inc/interfaces.inc | |
parent | 93a72cb88e0c456be4202def4a13f22acd25402b (diff) | |
download | pfsense-c0e5ab96e7bf77f1146f4df786a048e05a2eb5a2.zip pfsense-c0e5ab96e7bf77f1146f4df786a048e05a2eb5a2.tar.gz |
Destroy stf interface when 6rd or 6to4 tunnel is disabled. Fixes #4471
Conflicts:
etc/inc/interfaces.inc
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 104 |
1 files changed, 59 insertions, 45 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index e266ede..9984963 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1170,51 +1170,65 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg = $track6 = array(); switch ($ifcfg['ipaddrv6']) { - case "slaac": - case "dhcp6": - $pidv6 = find_dhcp6c_process($realif); - if($pidv6) - posix_kill($pidv6, SIGTERM); - sleep(3); - unlink_if_exists("{$g['varetc_path']}/dhcp6c_{$interface}.conf"); - if (does_interface_exist($realifv6)) { - $ip6 = find_interface_ipv6($realifv6); - if (is_ipaddrv6($ip6) && $ip6 != "::") - mwexec("/sbin/ifconfig " . escapeshellarg($realifv6) . " inet6 {$ip6} delete", true); - interface_ipalias_cleanup($interface, "inet6"); - if ($destroy == true) - pfSense_interface_flags($realif, -IFF_UP); - //mwexec("/usr/sbin/arp -d -i " . escapeshellarg($realif) . " -a"); - } - $track6 = link_interface_to_track6($interface); - break; - case "6rd": - case "6to4": - $realif = "{$interface}_stf"; - if(does_interface_exist("$realif")) { - $ip6 = get_interface_ipv6($interface); - if (is_ipaddrv6($ip6)) - mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 {$ip6} delete", true); - interface_ipalias_cleanup($interface, "inet6"); - if ($destroy == true) - pfSense_interface_flags($realif, -IFF_UP); - } - $track6 = link_interface_to_track6($interface); - break; - default: - if(does_interface_exist("$realif")) { - $ip6 = get_interface_ipv6($interface); - if (is_ipaddrv6($ip6)) - mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 {$ip6} delete", true); - if (!empty($ifcfg['ipaddrv6']) && is_ipaddrv6($ifcfg['ipaddrv6'])) - mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 {$ifcfg['ipaddrv6']} delete", true); - interface_ipalias_cleanup($interface, "inet6"); - if ($destroy == true) - pfSense_interface_flags($realif, -IFF_UP); - //mwexec("/usr/sbin/arp -d -i " . escapeshellarg($realif) . " -a"); - } - $track6 = link_interface_to_track6($interface); - break; + case "slaac": + case "dhcp6": + $pidv6 = find_dhcp6c_process($realif); + if ($pidv6) { + posix_kill($pidv6, SIGTERM); + } + sleep(3); + unlink_if_exists("{$g['varetc_path']}/dhcp6c_{$interface}.conf"); + if (does_interface_exist($realifv6)) { + $ip6 = find_interface_ipv6($realifv6); + if (is_ipaddrv6($ip6) && $ip6 != "::") { + mwexec("/sbin/ifconfig " . escapeshellarg($realifv6) . " inet6 {$ip6} delete", true); + } + interface_ipalias_cleanup($interface, "inet6"); + if ($destroy == true) { + pfSense_interface_flags($realif, -IFF_UP); + } + //mwexec("/usr/sbin/arp -d -i " . escapeshellarg($realif) . " -a"); + } + $track6 = link_interface_to_track6($interface); + break; + case "6rd": + case "6to4": + $realif = "{$interface}_stf"; + if (does_interface_exist("$realif")) { + /* destroy stf interface if tunnel is being disabled or tunnel type is being changed */ + if (($ifcfg['ipaddrv6'] == '6rd' && (!isset($config['interfaces'][$interface]['ipaddrv6']) || $config['interfaces'][$interface]['ipaddrv6'] != '6rd')) || + ($ifcfg['ipaddrv6'] == '6to4' && (!isset($config['interfaces'][$interface]['ipaddrv6']) || $config['interfaces'][$interface]['ipaddrv6'] != '6to4'))) { + $destroy = true; + } else { + /* get_interface_ipv6() returns empty value if interface is being disabled */ + $ip6 = get_interface_ipv6($interface); + if (is_ipaddrv6($ip6)) + mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 {$ip6} delete", true); + } + interface_ipalias_cleanup($interface, "inet6"); + if ($destroy == true) { + pfSense_interface_flags($realif, -IFF_UP); + } + } + $track6 = link_interface_to_track6($interface); + break; + default: + if (does_interface_exist("$realif")) { + $ip6 = get_interface_ipv6($interface); + if (is_ipaddrv6($ip6)) { + mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 {$ip6} delete", true); + } + if (!empty($ifcfg['ipaddrv6']) && is_ipaddrv6($ifcfg['ipaddrv6'])) { + mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 {$ifcfg['ipaddrv6']} delete", true); + } + interface_ipalias_cleanup($interface, "inet6"); + if ($destroy == true) { + pfSense_interface_flags($realif, -IFF_UP); + } + //mwexec("/usr/sbin/arp -d -i " . escapeshellarg($realif) . " -a"); + } + $track6 = link_interface_to_track6($interface); + break; } if (!empty($track6) && is_array($track6)) { |