Commit 678aa412 authored by Ad Schellevis's avatar Ad Schellevis

some more config handling fixes in inc directory, for https://github.com/opnsense/core/issues/1733

parent f0e2126f
......@@ -482,7 +482,7 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive
continue;
}
$ifcfg = &$config['interfaces'][$ifname];
$ifcfg = &config_read_array('interfaces', $ifname);
if (!empty($ifcfg['ipaddr']) && is_ipaddrv4($ifcfg['ipaddr'])) {
continue;
......@@ -557,7 +557,7 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive
continue;
}
$ifcfg = &$config['interfaces'][$ifname];
$ifcfg = &config_read_array('interfaces', $ifname);
if (!empty($ifcfg['ipaddrv6']) && is_ipaddrv6($ifcfg['ipaddrv6'])) {
continue;
......
......@@ -3912,7 +3912,7 @@ function get_real_interface($interface = "wan", $family = "all", $realv6iface =
break;
}
$cfg = &$config['interfaces'][$interface];
$cfg = &config_read_array('interfaces', $interface);
if ($family == "inet6") {
if (isset($cfg['ipaddrv6'])) {
......@@ -4367,7 +4367,7 @@ function interface_has_gateway($friendly)
global $config;
if (!empty($config['interfaces'][$friendly])) {
$ifname = &$config['interfaces'][$friendly];
$ifname = &config_read_array('interfaces', $friendly);
switch ($ifname['ipaddr']) {
case "dhcp":
case "pppoe":
......@@ -4400,7 +4400,7 @@ function interface_has_gatewayv6($friendly)
global $config;
if (!empty($config['interfaces'][$friendly])) {
$ifname = &$config['interfaces'][$friendly];
$ifname = &config_read_array('interfaces', $friendly);
if (isset($ifname['ipaddrv6'])) {
$ipaddrv6 = $ifname['ipaddrv6'];
} else {
......
......@@ -153,9 +153,9 @@ function plugins_interfaces()
}
if (isset($config['interfaces'][$intf_ref][0])) {
// undo stupid listags() turning our item into a new array, see src/etc/inc/xmlparse.inc
$intf_config = &$config['interfaces'][$intf_ref][0];
$intf_config = &config_read_array('interfaces', $intf_ref, 0);
} else {
$intf_config = &$config['interfaces'][$intf_ref];
$intf_config = &config_read_array('interfaces', $intf_ref);
}
$intf_config['internal_dynamic'] = true;
// traverse and diff interface properties with known configuration
......
......@@ -64,11 +64,11 @@ function webgui_configure_do($verbose = false)
if (!is_array($config['ca'])) {
$config['ca'] = array();
}
$a_ca =& $config['ca'];
$a_ca = &config_read_array('ca');
if (!is_array($config['cert'])) {
$config['cert'] = array();
}
$a_cert =& $config['cert'];
$a_cert = &config_read_array('cert');
log_error("Creating SSL certificate for this host");
$cert = array();
$cert['refid'] = uniqid();
......
......@@ -1321,7 +1321,7 @@ function services_dhcrelay_configure($verbose = false)
killbypid('/var/run/dhcrelay.pid', 'TERM', true);
$dhcrelaycfg = &$config['dhcrelay'];
$dhcrelaycfg = &config_read_array('dhcrelay');
if (!isset($dhcrelaycfg['enable'])) {
return;
......@@ -1440,7 +1440,7 @@ function services_dhcrelay6_configure($verbose = false)
killbypid('/var/run/dhcrelay6.pid', 'TERM', true);
$dhcrelaycfg = &$config['dhcrelay6'];
$dhcrelaycfg = &config_read_array('dhcrelay6');
if (!isset($dhcrelaycfg['enable'])) {
return;
......
......@@ -696,7 +696,7 @@ function get_configured_carp_interface_list($carpinterface = '', $family = 'inet
$iflist = array();
if (isset($config['virtualip']['vip'])) {
$viparr = &$config['virtualip']['vip'];
$viparr = &config_read_array('virtualip', 'vip');
foreach ($viparr as $vip) {
switch ($vip['mode']) {
case "carp":
......@@ -727,7 +727,7 @@ function get_configured_ip_aliases_list($returnfullentry = false)
$alias_list = array();
if (isset($config['virtualip']['vip'])) {
$viparr = &$config['virtualip']['vip'];
$viparr = &config_read_array('virtualip', 'vip');
foreach ($viparr as $vip) {
if ($vip['mode']=="ipalias") {
if ($returnfullentry) {
......@@ -747,7 +747,7 @@ function get_configured_vips_list()
global $config;
$alias_list=array();
if (isset($config['virtualip']['vip'])) {
$viparr = &$config['virtualip']['vip'];
$viparr = &config_read_array('virtualip', 'vip');
foreach ($viparr as $vip) {
if ($vip['mode'] == "carp") {
$alias_list[] = array("ipaddr" => $vip['subnet'], "if" => "{$vip['interface']}_vip{$vip['vhid']}");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment