diff options
author | smos <seth.mos@dds.nl> | 2012-01-15 13:07:36 +0100 |
---|---|---|
committer | smos <seth.mos@dds.nl> | 2012-01-15 13:07:36 +0100 |
commit | 584183558e2aafcd2d7dce6e5aaff34e96cb6e56 (patch) | |
tree | 4f5e2acb5bb23164df6122ebee13d345ac8a0147 | |
parent | 35af71416e19868fd09ec6701114c208fa4a1c4d (diff) | |
download | pfsense-584183558e2aafcd2d7dce6e5aaff34e96cb6e56.zip pfsense-584183558e2aafcd2d7dce6e5aaff34e96cb6e56.tar.gz |
Show the interface Link Local addresses on the status_interfaces.php
-rw-r--r-- | etc/inc/interfaces.inc | 39 | ||||
-rw-r--r-- | etc/inc/pfsense-utils.inc | 1 | ||||
-rwxr-xr-x | usr/local/www/status_interfaces.php | 11 |
3 files changed, 35 insertions, 16 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index c89861f..10e8d0d 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -3729,8 +3729,7 @@ function find_interface_ipv6($interface, $flush = false) */ function find_interface_ipv6_ll($interface, $flush = false) { - global $interface_ipv6_arr_cache; - global $interface_snv6_arr_cache; + global $interface_llv6_arr_cache; global $config; $interface = str_replace("\n", "", $interface); @@ -3739,7 +3738,7 @@ function find_interface_ipv6_ll($interface, $flush = false) return; /* Setup IP cache */ - if (!isset($interface_ipv6_arr_cache[$interface]) or $flush) { + if (!isset($interface_llv6_arr_cache[$interface]) or $flush) { $ifinfo = pfSense_get_interface_addresses($interface); // FIXME: Add IPv6 support to the pfSense module exec("/sbin/ifconfig {$interface} inet6", $output); @@ -3747,21 +3746,14 @@ function find_interface_ipv6_ll($interface, $flush = false) if(preg_match("/inet6/", $line)) { $parts = explode(" ", $line); if(preg_match("/fe80::/", $parts[1])) { - $ifinfo['ipaddrv6'] = $parts[1]; - if($parts[2] == "-->") { - $parts[5] = "126"; - $ifinfo['subnetbitsv6'] = $parts[5]; - } else { - $ifinfo['subnetbitsv6'] = $parts[3]; - } + $partsaddress = explode("%", $parts[1]); + $ifinfo['linklocal'] = $partsaddress[0]; } } } - $interface_ipv6_arr_cache[$interface] = $ifinfo['ipaddrv6']; - $interface_snv6_arr_cache[$interface] = $ifinfo['subnetbitsv6']; + $interface_llv6_arr_cache[$interface] = $ifinfo['linklocal']; } - - return $interface_ipv6_arr_cache[$interface]; + return $interface_llv6_arr_cache[$interface]; } function find_interface_subnet($interface, $flush = false) @@ -3875,6 +3867,25 @@ function get_interface_ipv6($interface = "wan") return null; } +function get_interface_linklocal($interface = "wan") +{ + $realif = get_real_interface($interface); + if (!$realif) { + if (preg_match("/^carp/i", $interface)) + $realif = $interface; + else if (preg_match("/^vip/i", $interface)) + $realif = $interface; + else + return null; + } + + $curip = find_interface_ipv6_ll($realif); + if ($curip && is_ipaddrv6($curip) && ($curip != "::")) + return $curip; + else + return null; +} + function get_interface_subnet($interface = "wan") { $realif = get_real_interface($interface); diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index f93bd20..c1cf525 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1120,6 +1120,7 @@ function get_interface_info($ifdescr) { $ifinfo['macaddr'] = $ifinfotmp['macaddr']; $ifinfo['ipaddr'] = $ifinfotmp['ipaddr']; $ifinfo['subnet'] = $ifinfotmp['subnet']; + $ifinfo['linklocal'] = get_interface_linklocal($ifdescr); $ifinfo['ipaddrv6'] = get_interface_ipv6($ifdescr); $ifinfo['subnetv6'] = get_interface_subnetv6($ifdescr); if (isset($ifinfotmp['link0'])) diff --git a/usr/local/www/status_interfaces.php b/usr/local/www/status_interfaces.php index 61ce262..e998ae1 100755 --- a/usr/local/www/status_interfaces.php +++ b/usr/local/www/status_interfaces.php @@ -210,8 +210,15 @@ include("head.inc"); <?=htmlspecialchars($ifinfo['gateway']);?> </td> </tr> - <?php endif; ?> - <?php if ($ifinfo['ipaddrv6']): ?> + <?php endif; ?><?php if ($ifinfo['linklocal']): ?> + <tr> + <td width="22%" class="vncellt"><?=gettext("IPv6 Link Local");?></td> + <td width="78%" class="listr"> + <?=htmlspecialchars($ifinfo['linklocal']);?> + + </td> + </tr> + <?php endif; ?><?php if ($ifinfo['ipaddrv6']): ?> <tr> <td width="22%" class="vncellt"><?=gettext("IPv6 address");?></td> <td width="78%" class="listr"> |