diff options
-rw-r--r-- | etc/inc/gwlb.inc | 2 | ||||
-rw-r--r-- | etc/inc/interfaces.inc | 6 | ||||
-rw-r--r-- | etc/inc/system.inc | 2 | ||||
-rw-r--r-- | usr/local/www/services_dhcpv6.php | 8 | ||||
-rw-r--r-- | usr/local/www/services_router_advertisements.php | 8 | ||||
-rwxr-xr-x | usr/local/www/system_gateways_edit.php | 2 |
6 files changed, 14 insertions, 14 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 5864733..e703893 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -165,7 +165,7 @@ EOD; continue; //Skip this target } else if (is_ipaddrv6($gateway['gateway'])) { /* link locals really need a different src ip */ - if(preg_match("/fe80:/i", $gateway['gateway'])) { + if(is_linklocal($gateway['gateway'])) { $linklocal = explode("%", find_interface_ipv6_ll($gateway['interface'], true)); $gwifip = $linklocal[0]; $ifscope = "%". $linklocal[1]; diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 566d301..81a1d5f 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -4281,7 +4281,7 @@ function find_interface_ipv6($interface, $flush = false) { foreach($output as $line) { if(preg_match("/inet6/", $line)) { $parts = explode(" ", $line); - if(! preg_match("/fe80:/i", $parts[1])) { + if(!is_linklocal($parts[1])) { $ifinfo['ipaddrv6'] = $parts[1]; if($parts[2] == "-->") { $parts[5] = "126"; @@ -4320,7 +4320,7 @@ function find_interface_ipv6_ll($interface, $flush = false) { foreach($output as $line) { if(preg_match("/inet6/", $line)) { $parts = explode(" ", $line); - if(preg_match("/fe80:/i", $parts[1])) { + if(is_linklocal($parts[1])) { $partsaddress = explode("%", $parts[1]); $ifinfo['linklocal'] = $partsaddress[0]; } @@ -4366,7 +4366,7 @@ function find_interface_subnetv6($interface, $flush = false) { $line = trim($line); if(preg_match("/inet6/", $line)) { $parts = explode(" ", $line); - if(! preg_match("/fe80:/i", $parts[1])) { + if(!is_linklocal($parts[1])) { $ifinfo['ipaddrv6'] = $parts[1]; if($parts[2] == "-->") { $parts[5] = "126"; diff --git a/etc/inc/system.inc b/etc/inc/system.inc index a214a7f..f6b472e 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -440,7 +440,7 @@ function system_routing_configure($interface = "") { ; else if (($interfacegwv6 <> "bgpd") && (is_ipaddrv6($gatewayipv6))) { $ifscope = ""; - if(preg_match("/fe80:/i", $gatewayipv6)) + if(is_linklocal($gatewayipv6)) $ifscope = "%{$defaultifv6}"; log_error("ROUTING: setting IPv6 default route to {$gatewayipv6}{$ifscope}"); mwexec("/sbin/route change -inet6 default " . escapeshellarg($gatewayipv6) ."{$ifscope}"); diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 7872721..51f6208 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -81,8 +81,8 @@ $iflist = array_merge($iflist, get_configured_pppoe_server_interfaces()); if (!$if || !isset($iflist[$if])) { foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; - if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!preg_match("/fe80:/i", $oc['ipaddrv6'])))) || - (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!preg_match("/fe80:/i", $oc['ipaddrv6']))))) + if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) || + (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) continue; $if = $ifent; break; @@ -471,8 +471,8 @@ include("head.inc"); $i = 0; foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; - if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!preg_match("/fe80:/i", $oc['ipaddrv6'])))) || - (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!preg_match("/fe80:/i", $oc['ipaddrv6']))))) + if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) || + (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) continue; if ($ifent == $if) $active = true; diff --git a/usr/local/www/services_router_advertisements.php b/usr/local/www/services_router_advertisements.php index 8a890a5..773cb6f 100644 --- a/usr/local/www/services_router_advertisements.php +++ b/usr/local/www/services_router_advertisements.php @@ -80,8 +80,8 @@ $iflist = get_configured_interface_with_descr(); if (!$if || !isset($iflist[$if])) { foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; - if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!preg_match("/fe80:/i", $oc['ipaddrv6'])))) || - (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!preg_match("/fe80:/i", $oc['ipaddrv6']))))) + if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) || + (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) continue; $if = $ifent; break; @@ -229,8 +229,8 @@ include("head.inc"); $i = 0; foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; - if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!preg_match("/fe80:/i", $oc['ipaddrv6'])))) || - (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!preg_match("/fe80:/i", $oc['ipaddrv6']))))) + if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) || + (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) continue; if ($ifent == $if) $active = true; diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index ccaa59d..48f4dec 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -141,7 +141,7 @@ if ($_POST) { } else if(is_ipaddrv6($_POST['gateway'])) { /* do not do a subnet match on a link local address, it's valid */ - if(! preg_match("/fe80:/i", $_POST['gateway'])) { + if(!is_linklocal($_POST['gateway'])) { $parent_ip = get_interface_ipv6($_POST['interface']); $parent_sn = get_interface_subnetv6($_POST['interface']); if(empty($parent_ip) || empty($parent_sn)) { |