Project

General

Profile

« Previous | Next » 

Revision 76165eac

Added by Phil Davis over 12 years ago

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.

View differences:

usr/local/www/status_graph.php
79 79
		exit;
80 80
	}
81 81
} else {
82
	$curif = "wan";
82
	if (empty($ifdescrs["wan"])) {
83
		/* Handle the case when WAN has been disabled. Use the first key in ifdescrs. */
84
		reset($ifdescrs);
85
		$curif = key($ifdescrs);
86
	}
87
	else {
88
		$curif = "wan";
89
	}
83 90
}
84 91
if ($_GET['sort']) {
85 92
	$cursort = $_GET['sort'];

Also available in: Unified diff