Routing, gateways. in services.inc/services_dhcpdv4_configure() remove the need for return_gateways_array(), related to https://github.com/opnsense/core/issues/2279

This commit is contained in:
Ad Schellevis 2019-04-12 11:55:43 +02:00
parent 208f54665f
commit 4494f5cf24

View File

@ -498,17 +498,6 @@ authoritative;
EOD;
$dhcpdifs = array();
$add_routers = false;
$gateways_arr = return_gateways_array();
/* only add a routers line if the system has any IPv4 gateway at all */
/* a static route has a gateway, manually overriding this field always works */
foreach ($gateways_arr as $gwitem) {
if ($gwitem['ipprotocol'] == "inet") {
$add_routers = true;
break;
}
}
/* loop through and determine if we need to setup
* failover peer "bleh" entries
*/
@ -805,15 +794,15 @@ EOPP;
}
// End of settings inside pools
if (!empty($dhcpifconf['gateway']) && $dhcpifconf['gateway'] != "none") {
$routers = $dhcpifconf['gateway'];
$add_routers = true;
} elseif (!empty($dhcpifconf['gateway']) && $dhcpifconf['gateway'] == "none") {
$add_routers = false;
} else {
if (!empty($dhcpifconf['gateway'])) {
$routers = $dhcpifconf['gateway'] != "none" ? $dhcpifconf['gateway'] : null;
} elseif ((new \OPNsense\Routing\Gateways(legacy_interfaces_details()))->hasGateways("inet")) {
// by default, add interface address in "option routers"
$routers = $ifcfgip;
} else {
$routers = null;
}
if ($add_routers) {
if (!empty($routers)) {
$dhcpdconf .= " option routers {$routers};\n";
}