summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorgnhb <gnoahb@gmail.com>2010-06-08 07:06:46 +0700
committergnhb <gnoahb@gmail.com>2010-06-08 07:06:46 +0700
commitb20f736344a3e68c0b89b773df0ce2b9c9476757 (patch)
treeabe8b5867b859c4dfd707dacd640570ee995bc65 /etc
parent277d0250b0b344893c166df91cb66c2269ade1de (diff)
parentf4a17fcfe7b77fec9b0f8752e2a5c3430e8e6dbd (diff)
downloadpfsense-b20f736344a3e68c0b89b773df0ce2b9c9476757.zip
pfsense-b20f736344a3e68c0b89b773df0ce2b9c9476757.tar.gz
Merge branch 'master' of http://gitweb.pfsense.org/pfsense/mainline into mlppp
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/gwlb.inc29
-rw-r--r--etc/inc/vpn.inc50
2 files changed, 45 insertions, 34 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 70bfd52..cbb9055 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -256,8 +256,8 @@ function return_gateways_status() {
$target = $info[0];
$status[$target]['name'] = $info[1];
$status[$target]['lastcheck'] = $info[4] ? date('r', $info[4]) : date('r');
- $status[$target]['delay'] = $info[5];
- $status[$target]['loss'] = $info[6];
+ $status[$target]['delay'] = empty($info[5]) ? 0 : $info[5];
+ $status[$target]['loss'] = empty($info[6]) ? "0.0%" : $info[6] . "%";
$status[$target]['status'] = trim($info[7]);
}
return($status);
@@ -458,19 +458,15 @@ function dhclient_update_gateway_groups_defaultroute($interface = "wan") {
}
function lookup_gateway_ip_by_name($name) {
- global $config;
- if(is_array($config['gateways']['gateway_item'])) {
- foreach($config['gateways']['gateway_item'] as $gateway) {
- if($gateway['name'] == $name)
- return ($gateway['gateway']);
- }
- } else
- return (false);
+ $gateways_arr = return_gateways_array();
+ if (!empty($gateways_arr[$name]))
+ return $gateways_arr[$name]['gateway'];
+
+ return false;
}
function lookup_gateway_monitor_ip_by_name($name) {
- global $config;
$gateways_arr = return_gateways_array();
if (!empty($gateways_arr[$name])) {
@@ -489,7 +485,6 @@ function lookup_gateway_monitor_ip_by_name($name) {
}
function lookup_gateway_interface_by_name($name) {
- global $config;
$gateways_arr = return_gateways_array();
if (!empty($gateways_arr[$name])) {
@@ -509,8 +504,14 @@ function get_interface_gateway($interface, &$dynamic = false) {
$gwcfg = $config['interfaces'][$interface];
if (is_ipaddr($gwcfg['gateway']))
$gw = $gwcfg['gateway'];
- else if (!empty($gwcfg['gateway']))
- $gw = lookup_gateway_ip_by_name($gwcfg['gateway']);
+ else if (!empty($gwcfg['gateway']) && is_array($config['gateways']['gateway_item'])) {
+ foreach($config['gateways']['gateway_item'] as $gateway) {
+ if ($gateway['name'] == $gwcfg['gateway']) {
+ $gw = $gateway['gateway'];
+ break;
+ }
+ }
+ }
// for dynamic interfaces we handle them through the $interface_router file.
if (!is_ipaddr($gw) && !is_ipaddr($gwcfg['ipaddr'])) {
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc
index f38a0ff..a98969d 100644
--- a/etc/inc/vpn.inc
+++ b/etc/inc/vpn.inc
@@ -1065,18 +1065,20 @@ EOD;
if (isset($pptpdcfg["wins"]) && $pptpdcfg['wins'] != "")
$mpdconf .= " set ipcp nbns {$pptpdcfg['wins']}\n";
- if (is_array($pptpdcfg['dnsserver']) && ($pptpdcfg['dnsserver'][0])) {
- $mpdconf .= " set ipcp dns " . join(" ", $pptpdcfg['dnsserver']) . "\n";
- } else
- if (isset ($config['dnsmasq']['enable'])) {
- $mpdconf .= " set ipcp dns " . get_interface_ip("lan");
- if ($syscfg['dnsserver'][0])
- $mpdconf .= " " . $syscfg['dnsserver'][0];
- $mpdconf .= "\n";
- } else
- if (is_array($syscfg['dnsserver']) && ($syscfg['dnsserver'][0])) {
- $mpdconf .= " set ipcp dns " . join(" ", $syscfg['dnsserver']) . "\n";
- }
+
+ if (!empty($pptpdcfg['dns1'])) {
+ $mpdconf .= " set ipcp dns " . $pptpdcfg['dns1'];
+ if (!empty($pptpdcfg['dns2']))
+ $mpdconf .= " " . $pptpdcfg['dns2'];
+ $mpdconf .= "\n";
+ } elseif (isset ($config['dnsmasq']['enable'])) {
+ $mpdconf .= " set ipcp dns " . get_interface_ip("lan");
+ if ($syscfg['dnsserver'][0])
+ $mpdconf .= " " . $syscfg['dnsserver'][0];
+ $mpdconf .= "\n";
+ } elseif (is_array($syscfg['dnsserver']) && ($syscfg['dnsserver'][0])) {
+ $mpdconf .= " set ipcp dns " . join(" ", $syscfg['dnsserver']) . "\n";
+ }
if (isset ($pptpdcfg['radius']['server']['enable'])) {
$authport = (isset($pptpdcfg['radius']['server']['port']) && strlen($pptpdcfg['radius']['server']['port']) > 1) ? $pptpdcfg['radius']['server']['port'] : 1812;
@@ -1274,15 +1276,19 @@ pppoe_standart:
EOD;
- if (isset ($config['dnsmasq']['enable'])) {
+ if (!empty($pppoecfg['dns1'])) {
+ $mpdconf .= " set ipcp dns " . $pppoecfg['dns1'];
+ if (!empty($pppoecfg['dns2']))
+ $mpdconf .= " " . $pppoecfg['dns2'];
+ $mpdconf .= "\n";
+ } elseif (isset ($config['dnsmasq']['enable'])) {
$mpdconf .= " set ipcp dns " . get_interface_ip("lan");
if ($syscfg['dnsserver'][0])
$mpdconf .= " " . $syscfg['dnsserver'][0];
$mpdconf .= "\n";
- } else
- if (is_array($syscfg['dnsserver']) && ($syscfg['dnsserver'][0])) {
+ } elseif (is_array($syscfg['dnsserver']) && ($syscfg['dnsserver'][0])) {
$mpdconf .= " set ipcp dns " . join(" ", $syscfg['dnsserver']) . "\n";
- }
+ }
if (isset ($pppoecfg['radius']['enable'])) {
$mpdconf .=<<<EOD
@@ -1454,15 +1460,19 @@ l2tp_standard:
EOD;
- if (isset ($config['dnsmasq']['enable'])) {
+ if (!empty($l2tpcfg['dns1'])) {
+ $mpdconf .= " set ipcp dns " . $l2tpcfg['dns1'];
+ if (!empty($l2tpcfg['dns2']))
+ $mpdconf .= " " . $l2tpcfg['dns2'];
+ $mpdconf .= "\n";
+ } elseif (isset ($config['dnsmasq']['enable'])) {
$mpdconf .= " set ipcp dns " . get_interface_ip("lan");
if ($syscfg['dnsserver'][0])
$mpdconf .= " " . $syscfg['dnsserver'][0];
$mpdconf .= "\n";
- } else
- if (is_array($syscfg['dnsserver']) && ($syscfg['dnsserver'][0])) {
+ } elseif (is_array($syscfg['dnsserver']) && ($syscfg['dnsserver'][0])) {
$mpdconf .= " set ipcp dns " . join(" ", $syscfg['dnsserver']) . "\n";
- }
+ }
if (isset ($l2tpcfg['radius']['enable'])) {
$mpdconf .=<<<EOD
OpenPOWER on IntegriCloud