mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Correctly configure the default route addition when interfaces are configured for pppoe/pptp. Handle in system routing configure dynamic interfaces. Also when chaning or configuring the defaultgw reconfigure the underlying interface, this helps when this interfaces are dynamics one.
This commit is contained in:
parent
68ff67b360
commit
c0f5182ce0
@ -2034,7 +2034,20 @@ EOD;
|
||||
set iface name {$realif}
|
||||
|
||||
EOD;
|
||||
if ($interface == "wan")
|
||||
$setdefaultgw = false;
|
||||
$founddefaultgw = false;
|
||||
if (is_array($config['gateways']['gateway_item'])) {
|
||||
foreach($config['gateways']['gateway_item'] as $gateway) {
|
||||
if($interface == $gateway['interface'] && isset($gateway['defaultgw'])) {
|
||||
$setdefaultgw = true;
|
||||
break;
|
||||
} else if (isset($gateway['defaultgw'])) {
|
||||
$founddefaultgw = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($interface == "wan" && $founddefaultgw == false) || $setdefaultgw == true)
|
||||
$mpdconf .= <<<EOD
|
||||
set iface route default
|
||||
|
||||
@ -2183,7 +2196,20 @@ EOD;
|
||||
set iface name {$realif}
|
||||
|
||||
EOD;
|
||||
if ($interface == "wan")
|
||||
$setdefaultgw = false;
|
||||
$founddefaultgw = false;
|
||||
if (is_array($config['gateways']['gateway_item'])) {
|
||||
foreach($config['gateways']['gateway_item'] as $gateway) {
|
||||
if($interface == $gateway['interface'] && isset($gateway['defaultgw'])) {
|
||||
$setdefaultgw = true;
|
||||
break;
|
||||
} else if (isset($gateway['defaultgw'])) {
|
||||
$founddefaultgw = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($interface == "wan" && $founddefaultgw == false) || $setdefaultgw == true)
|
||||
$mpdconf .= <<<EOD
|
||||
set iface route default
|
||||
|
||||
|
||||
@ -314,6 +314,10 @@ function system_routing_configure() {
|
||||
if(isset($gateway['defaultgw'])) {
|
||||
$gatewayip = $gateway['gateway'];
|
||||
$interfacegw = $gateway['interface'];
|
||||
/* This handles the case where a dynamic gateway is choosen as default. */
|
||||
if (!is_ipaddr($gatewayip))
|
||||
$gatewayip = get_interface_gateway($interfacegw);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(($interfacegw <> "bgpd") && (is_ipaddr($gatewayip))) {
|
||||
@ -353,13 +357,17 @@ function system_routing_configure() {
|
||||
if($rtent['gateway'] == $gateway['name']) {
|
||||
$gatewayip = $gateway['gateway'];
|
||||
$interfacegw = $gateway['interface'];
|
||||
/* This handles the case where a dynamic gateway is choosen. */
|
||||
if (!is_ipaddr($gatewayip))
|
||||
$gatewayip = get_interface_gateway($interfacegw);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if((is_ipaddr($rtent['gateway'])) && ($gatewayip == "")) {
|
||||
if((is_ipaddr($rtent['gateway'])) && empty($gatewayip)) {
|
||||
$gatewayip = $rtent['gateway'];
|
||||
$interfacegw = $rtent['interface'];
|
||||
}
|
||||
}
|
||||
if((isset($rtent['interfacegateway'])) && (! is_ipaddr($gatewayip))) {
|
||||
mwexec("/sbin/route add " . escapeshellarg($rtent['network']) .
|
||||
" -iface " . escapeshellarg(convert_friendly_interface_to_real_interface_name($interfacegw)));
|
||||
|
||||
@ -164,6 +164,7 @@ if ($_POST) {
|
||||
/* Manual gateways are handled differently */
|
||||
/* rebuild the array with the manual entries only */
|
||||
|
||||
$reloadif = false;
|
||||
$gateway = array();
|
||||
$gateway['interface'] = $_POST['interface'];
|
||||
$gateway['name'] = $_POST['name'];
|
||||
@ -181,6 +182,7 @@ if ($_POST) {
|
||||
$i++;
|
||||
}
|
||||
$gateway['defaultgw'] = true;
|
||||
$reloadif = true;
|
||||
} else {
|
||||
unset($gateway['defaultgw']);
|
||||
}
|
||||
@ -200,7 +202,8 @@ if ($_POST) {
|
||||
if($_REQUEST['isAjax']) {
|
||||
echo $_POST['name'];
|
||||
exit;
|
||||
}
|
||||
} else if ($reloadif == true)
|
||||
interface_configure($_POST['interface']);
|
||||
|
||||
header("Location: system_gateways.php");
|
||||
exit;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user