From dda80e7602bd190667aa23ce371eb8c3925f6459 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 14 Sep 2015 15:11:57 -0400 Subject: Fix source address selection on Test Port to handle VIPs properly. --- src/usr/local/www/diag_testport.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/usr') diff --git a/src/usr/local/www/diag_testport.php b/src/usr/local/www/diag_testport.php index 3b7cf5a..4fe9c4f 100644 --- a/src/usr/local/www/diag_testport.php +++ b/src/usr/local/www/diag_testport.php @@ -139,7 +139,15 @@ if ($_POST || $_REQUEST['host']) { /* Attempt to determine the interface address, if possible. Else try both. */ if (is_ipaddrv4($host)) { - $ifaddr = ($sourceip == "any") ? "" : get_interface_ip($sourceip); + if ($sourceip == "any") { + $ifaddr = ""; + } else { + if (is_ipaddr($sourceip)) { + $ifaddr = $sourceip; + } else { + $ifaddr = get_interface_ip($sourceip); + } + } $nc_args .= ' -4'; } elseif (is_ipaddrv6($host)) { if ($sourceip == "any") -- cgit v1.1