summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-05-09 08:03:45 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-05-09 08:05:13 -0300
commitdb7a628c0f3bfefc2792908f1646fcb604eedd5c (patch)
tree440e5cd682b137ca8b912650ec7f01aea44b73dc
parent19341491e34d2f003284cb7df03cad920116d196 (diff)
downloadpfsense-db7a628c0f3bfefc2792908f1646fcb604eedd5c.zip
pfsense-db7a628c0f3bfefc2792908f1646fcb604eedd5c.tar.gz
Replace all linklocal checks by is_linklocal()
-rw-r--r--etc/inc/gwlb.inc2
-rw-r--r--etc/inc/interfaces.inc6
-rw-r--r--etc/inc/system.inc2
-rw-r--r--usr/local/www/services_dhcpv6.php8
-rw-r--r--usr/local/www/services_router_advertisements.php8
-rwxr-xr-xusr/local/www/system_gateways_edit.php2
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)) {
OpenPOWER on IntegriCloud