diff options
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/sbin/ntpdate_sync_once.sh | 2 | ||||
-rwxr-xr-x | usr/local/www/firewall_virtual_ip_edit.php | 20 | ||||
-rwxr-xr-x | usr/local/www/interfaces.php | 8 | ||||
-rwxr-xr-x | usr/local/www/status_queues.php | 13 | ||||
-rwxr-xr-x | usr/local/www/status_services.php | 11 |
5 files changed, 29 insertions, 25 deletions
diff --git a/usr/local/sbin/ntpdate_sync_once.sh b/usr/local/sbin/ntpdate_sync_once.sh index e899672..3809b23 100755 --- a/usr/local/sbin/ntpdate_sync_once.sh +++ b/usr/local/sbin/ntpdate_sync_once.sh @@ -29,7 +29,7 @@ fi if [ -f /var/etc/ntpd.conf ]; then echo "Starting NTP Daemon." | /usr/bin/logger -t ntp; - /usr/local/bin/ntpd -g -c /var/etc/ntpd.conf + /usr/local/bin/ntpd -g -c /var/etc/ntpd.conf -p /var/run/ntpd.pid else echo "NTP configuration file missing, not starting daemon." | /usr/bin/logger -t ntp; fi
\ No newline at end of file diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index 8682d5e..4e257ac 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -110,15 +110,17 @@ if ($_POST) { if ($_POST['subnet']) $_POST['subnet'] = trim($_POST['subnet']); - if (($_POST['subnet'] && !is_ipaddr($_POST['subnet']))) - $input_errors[] = gettext("A valid IP address must be specified."); + if ($_POST['subnet']) { + if (!is_ipaddr($_POST['subnet'])) + $input_errors[] = gettext("A valid IP address must be specified."); + else if (is_ipaddr_configured($_POST['subnet'], "vip_" . $id, true)) + $input_errors[] = gettext("This IPv4 address is being used by another interface or VIP."); + } $natiflist = get_configured_interface_with_descr(); foreach ($natiflist as $natif => $natdescr) { if ($_POST['interface'] == $natif && (empty($config['interfaces'][$natif]['ipaddr']) && empty($config['interfaces'][$natif]['ipaddrv6']))) $input_errors[] = gettext("The interface chosen for the VIP has no IPv4 or IPv6 address configured so it cannot be used as a parent for the VIP."); - if ($_POST['subnet'] == get_interface_ip($natif)) - $input_errors[] = sprintf(gettext("The %s IP address may not be used in a virtual entry."),$natdescr); } if(is_ipaddrv4($_POST['subnet'])) { @@ -129,16 +131,6 @@ if ($_POST) { if(($_POST['subnet_bits'] == "127" or $_POST['subnet_bits'] == "128") and $_POST['mode'] == "carp") $input_errors[] = gettext("The /127 and /128 subnet mask are invalid for CARP IPs."); } - /* check for overlaps with other virtual IP */ - foreach ($a_vip as $vipent) { - if (isset($id) && ($a_vip[$id]) && ($a_vip[$id] === $vipent)) - continue; - - if (isset($_POST['subnet']) && $_POST['subnet'] == $vipent['subnet']) { - $input_errors[] = gettext("There is already a virtual IP entry for the specified IP address."); - break; - } - } /* make sure new ip is within the subnet of a valid ip * on one of our interfaces (wan, lan optX) diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 73b6620..fcd7b51 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -544,8 +544,12 @@ if ($_POST['apply']) { /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac'])); - if (($_POST['ipaddr'] && !is_ipaddrv4($_POST['ipaddr']))) - $input_errors[] = gettext("A valid IPv4 address must be specified."); + if ($_POST['ipaddr']) { + if (!is_ipaddrv4($_POST['ipaddr'])) + $input_errors[] = gettext("A valid IPv4 address must be specified."); + else if (is_ipaddr_configured($_POST['ipaddr'], $if, true, true)) + $input_errors[] = gettext("This IPv4 address is being used by another interface or VIP."); + } if (($_POST['ipaddrv6'] && !is_ipaddrv6($_POST['ipaddrv6']))) $input_errors[] = gettext("A valid IPv6 address must be specified."); if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) diff --git a/usr/local/www/status_queues.php b/usr/local/www/status_queues.php index 5afe37a..657059f 100755 --- a/usr/local/www/status_queues.php +++ b/usr/local/www/status_queues.php @@ -94,7 +94,7 @@ if ($_REQUEST['getactivity']) { $finscript .= "jQuery('#queue{$q->queuename}widthb').width('{$packet_s}');"; $finscript .= "jQuery('#queue{$q->queuename}widtha').width('" . (200 - $packet_s) . "');"; $finscript .= "jQuery('#queue{$q->queuename}pps').val('" . number_format($q->pps,1) . "');"; - $finscript .= "jQuery('#queue{$q->queuename}bps').val('" . str_replace("bytes", "B", format_bytes($q->bandwidth)) . "ps');"; + $finscript .= "jQuery('#queue{$q->queuename}bps').val('" . format_bits($q->bandwidth) . "');"; $finscript .= "jQuery('#queue{$q->queuename}borrows').val('{$q->borrows}');"; $finscript .= "jQuery('#queue{$q->queuename}suspends').val('{$q->suspends}');"; $finscript .= "jQuery('#queue{$q->queuename}drops').val('{$q->drops}');"; @@ -252,4 +252,15 @@ function statsQueues($xml){ $statistics[] = $current; return $current; } +function format_bits($bits) { + if ($bits >= 1000000000) { + return sprintf("%.2f Gbps", $bits/1000000000); + } else if ($bits >= 1000000) { + return sprintf("%.2f Mbps", $bits/1000000); + } else if ($bits >= 1000) { + return sprintf("%.2f Kb", $bits/1000); + } else { + return sprintf("%d b", $bits); + } +} ?> diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php index 126a67a..608804f 100755 --- a/usr/local/www/status_services.php +++ b/usr/local/www/status_services.php @@ -40,6 +40,7 @@ require_once("guiconfig.inc"); require_once("captiveportal.inc"); require_once("service-utils.inc"); +require_once("openvpn.inc"); require_once("ipsec.inc"); require_once("vpn.inc"); require_once("vslb.inc"); @@ -83,12 +84,8 @@ if($_GET['mode'] == "restartservice" and !empty($_GET['service'])) { if ($vpnmode == "server" || $vpnmode == "client") { $id = $_GET['id']; $configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf"; - $pidfile = $g['varrun_path'] . "/openvpn_{$vpnmode}{$id}.pid"; - if (file_exists($configfile)) { - killbypid($pidfile); - sleep(1); - mwexec_bg("/usr/local/sbin/openvpn --config {$configfile}"); - } + if (file_exists($configfile)) + openvpn_restart_by_vpnid($vpnmode, $id); } break; case 'relayd': @@ -139,7 +136,7 @@ if($_GET['mode'] == "startservice" and !empty($_GET['service'])) { $id = $_GET['id']; $configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf"; if (file_exists($configfile)) - mwexec_bg("/usr/local/sbin/openvpn --config {$configfile}"); + openvpn_restart_by_vpnid($vpnmode, $id); } break; case 'relayd': |