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