From 52442f576c913c7da3d582555f8fb4ec43784db0 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Thu, 24 Mar 2005 05:26:29 +0000 Subject: Don't require a reboot for trivial changes such as bandwidth change Fully log what changed on write_config() --- usr/local/www/interfaces_lan.php | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/interfaces_lan.php b/usr/local/www/interfaces_lan.php index e133da2..fa0f0e6 100755 --- a/usr/local/www/interfaces_lan.php +++ b/usr/local/www/interfaces_lan.php @@ -48,6 +48,7 @@ if ($_POST) { unset($input_errors); $pconfig = $_POST; + $changedesc = "LAN Interface: "; /* input validation */ $reqdfields = explode(" ", "ipaddr subnet"); @@ -71,19 +72,37 @@ if ($_POST) { } if (!$input_errors) { - $lancfg['ipaddr'] = $_POST['ipaddr']; - $lancfg['subnet'] = $_POST['subnet']; - $lancfg['bandwidth'] = $_POST['bandwidth']; - $lancfg['bandwidthtype'] = $_POST['bandwidthtype']; + if (($lancfg['ipaddr'] != $_POST['ipaddr']) || ($lancfg['subnet'] != $_POST['subnet'])) { + if (($pconfig['ipaddr'] != $_POST['ipaddr'])) { + $changedesc .= " IP changed from {$lancfg['ipaddr']} to {$_POST['ipaddr']}"; + $lancfg['ipaddr'] = $_POST['ipaddr']; + } + if (($lancfg['subnet'] != $_POST['subnet'])) { + $changedesc .= " subnet changed from {$lancfg['subnet']} to {$_POST['subnet']}"; + $lancfg['subnet'] = $_POST['subnet']; + } + + /* We'll need to reboot after this */ + touch($d_sysrebootreqd_path); + } + + if ($lancfg['bandwidth'] != $_POST['bandwidth']) { + $changedesc .= " bandwidth changed from {$lancfg['bandwidth']} to {$_POST['bandwidth']}"; + $lancfg['bandwidth'] = $_POST['bandwidth']; + } + if ($lancfg['bandwidthtype'] != $_POST['bandwidthtype']) { + $changedesc .= " bandwidth type changed from {$lancfg['bandwidthtype']} to {$_POST['bandwidth']}"; + $lancfg['bandwidthtype'] = $_POST['bandwidthtype']; + } $dhcpd_was_enabled = 0; if (isset($config['dhcpd']['enable'])) { unset($config['dhcpd']['enable']); $dhcpd_was_enabled = 1; + $changedesc .= " DHCP was disabled"; } - write_config(); - touch($d_sysrebootreqd_path); + write_config($changedesc); $savemsg = get_std_save_message(0); -- cgit v1.1