summaryrefslogtreecommitdiffstats
path: root/usr/local/www/diag_testport.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-08-20 16:29:53 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-08-20 16:30:04 -0300
commitd318da67a09a46282d5a95a6606088965dd39fc0 (patch)
treef5f968fef78c8feebf4d644bf8f01b8f4ad374c0 /usr/local/www/diag_testport.php
parentbd6ff3288af51bdc71a17e1a65c66b9bee0d8d26 (diff)
downloadpfsense-d318da67a09a46282d5a95a6606088965dd39fc0.zip
pfsense-d318da67a09a46282d5a95a6606088965dd39fc0.tar.gz
Add scope to target when it is a link-local, it helps ticket #3150
Diffstat (limited to 'usr/local/www/diag_testport.php')
-rw-r--r--usr/local/www/diag_testport.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/usr/local/www/diag_testport.php b/usr/local/www/diag_testport.php
index 799ed83..c8aa6a3 100644
--- a/usr/local/www/diag_testport.php
+++ b/usr/local/www/diag_testport.php
@@ -200,7 +200,12 @@ include("head.inc"); ?>
$ifaddr = ($sourceip == "any") ? "" : get_interface_ip($sourceip);
$nc_args .= " -4";
} elseif (is_ipaddrv6($host)) {
- $ifaddr = ($sourceip == "any") ? "" : get_interface_ipv6($sourceip);
+ if ($sourceip == "any")
+ $ifaddr = "";
+ else if (is_linklocal($sourceip))
+ $ifaddr = $sourceip;
+ else
+ $ifaddr = get_interface_ipv6($sourceip);
$nc_args .= " -6";
} else {
switch ($ipprotocol) {
@@ -209,14 +214,14 @@ include("head.inc"); ?>
$nc_ipproto = " -4";
break;
case "ipv6":
- $ifaddr = get_interface_ipv6($sourceip);
+ $ifaddr = (is_linklocal($sourceip) ? $sourceip : get_interface_ipv6($sourceip));
$nc_ipproto = " -6";
break;
case "any":
$ifaddr = get_interface_ip($sourceip);
$nc_ipproto = (!empty($ifaddr)) ? " -4" : "";
if (empty($ifaddr)) {
- $ifaddr = get_interface_ipv6($sourceip);
+ $ifaddr = (is_linklocal($sourceip) ? $sourceip : get_interface_ipv6($sourceip));
$nc_ipproto = (!empty($ifaddr)) ? " -6" : "";
}
break;
@@ -237,8 +242,12 @@ include("head.inc"); ?>
}
}
/* Only add on the interface IP if we managed to find one. */
- if (!empty($ifaddr))
+ if (!empty($ifaddr)) {
$nc_args .= " -s " . escapeshellarg($ifaddr) . " ";
+ $scope = get_ll_scope($ifaddr);
+ if (!empty($scope) && !strstr($host, "%"))
+ $host .= "%{$scope}";
+ }
$nc_cmd = "{$nc_base_cmd} {$nc_args} " . escapeshellarg($host) . " " . escapeshellarg($port) . " 2>&1";
exec($nc_cmd, $result, $retval);
OpenPOWER on IntegriCloud