diff options
author | Phil Davis <phil.davis@world.inf.org> | 2012-12-31 17:59:40 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@world.inf.org> | 2012-12-31 17:59:40 +0545 |
commit | 76165eace0ff908eb1c7dfa436eba6be7ea1ea1a (patch) | |
tree | 9c869d750fe8f5adb14163e9886a03cb6acb8325 | |
parent | 2e4c921fcc177cd4f5213af57e1d7e8ce9e57e62 (diff) | |
download | pfsense-76165eace0ff908eb1c7dfa436eba6be7ea1ea1a.zip pfsense-76165eace0ff908eb1c7dfa436eba6be7ea1ea1a.tar.gz |
Select default interface when WAN is disabled
If WAN is disabled, then the Traffic Graph does not default to a valid interface when it first displays. This fix selects the first valid interface if WAN is not there.
e.g. at one site there used to be 2 ISPs, on WAN and OPT1. Now the ISP on WAN has been turned off, and the interface marked disabled. The default gateway etc is all on OPT1. After a bit of history at a site, it can happen like this that WAN is disabled in the config.
-rwxr-xr-x | usr/local/www/status_graph.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr/local/www/status_graph.php b/usr/local/www/status_graph.php index 7f59cb3..2313e66 100755 --- a/usr/local/www/status_graph.php +++ b/usr/local/www/status_graph.php @@ -79,7 +79,14 @@ if ($_GET['if']) { exit; } } else { - $curif = "wan"; + if (empty($ifdescrs["wan"])) { + /* Handle the case when WAN has been disabled. Use the first key in ifdescrs. */ + reset($ifdescrs); + $curif = key($ifdescrs); + } + else { + $curif = "wan"; + } } if ($_GET['sort']) { $cursort = $_GET['sort']; |