diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-08-20 16:29:53 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-08-20 16:29:53 -0300 |
commit | 3830eeb30d9b8dbf6f95d21a744a0b83df344476 (patch) | |
tree | 07fa5611d351855944d8ed1beff2a3402b4cdcf9 /usr/local | |
parent | 8f61cb87ecd12fe9da633546d59397dc2b61ebcc (diff) | |
download | pfsense-3830eeb30d9b8dbf6f95d21a744a0b83df344476.zip pfsense-3830eeb30d9b8dbf6f95d21a744a0b83df344476.tar.gz |
Add scope to target when it is a link-local, it helps ticket #3150
Diffstat (limited to 'usr/local')
-rw-r--r-- | usr/local/www/diag_testport.php | 17 |
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); |