Project

General

Profile

« Previous | Next » 

Revision bef138fa

Added by Reid Linnemann over 2 years ago

Replace direct config accesses in services_dhcpv6_relay.php. Fixes #13676

View differences:

src/usr/local/www/services_dhcpv6_relay.php
32 32

  
33 33
require_once("guiconfig.inc");
34 34

  
35
$pconfig['enable'] = isset($config['dhcrelay6']['enable']);
35
$pconfig['enable'] = config_path_enabled('dhcrelay6');
36 36

  
37
if (empty($config['dhcrelay6']['interface'])) {
38
	$pconfig['interface'] = array();
39
} else {
40
	$pconfig['interface'] = explode(",", $config['dhcrelay6']['interface']);
41
}
37
$pconfig['interface'] = explode(",", config_get_path('dhcrelay6/interface', ""));
42 38

  
43
$pconfig['agentoption'] = isset($config['dhcrelay6']['agentoption']);
44
$pconfig['server'] = $config['dhcrelay6']['server'];
45
$pconfig['carpstatusvip'] = isset($config['dhcrelay6']['carpstatusvip']) ? $config['dhcrelay6']['carpstatusvip'] : 'none';
39
$pconfig['agentoption'] = config_path_enabled('dhcrelay6', 'agentoption');
40
$pconfig['server'] = config_get_path('dhcrelay6/server');
41
$pconfig['carpstatusvip'] = config_get_path('dhcrelay6/carpstatusvip', 'none');
46 42

  
47 43
$iflist = array_intersect_key(
48 44
	get_configured_interface_with_descr(),
......
75 71
 *   the two are not compatible with each other.
76 72
 */
77 73
$dhcpd_enabled = false;
78
if (is_array($config['dhcpdv6'])) {
79
	foreach ($config['dhcpdv6'] as $dhcpif => $dhcp) {
80
		if (isset($dhcp['enable']) && isset($config['interfaces'][$dhcpif]['enable'])) {
81
			$dhcpd_enabled = true;
82
			break;
83
		}
74
foreach (config_get_path('dhcpdv6', []) as $dhcpif => $dhcp) {
75
	if (isset($dhcp['enable']) && config_path_enabled("interfaces/{$dhcpif}")) {
76
		$dhcpd_enabled = true;
77
		break;
84 78
	}
85 79
}
86 80

  
......
126 120

  
127 121
	if (!$input_errors) {
128 122
		init_config_arr(array('dhcrelay6'));
129
		$config['dhcrelay6']['enable'] = $_POST['enable'] ? true : false;
123
		config_set_path('dhcrelay6/enable', $_POST['enable'] ? true : false);
130 124
		if (isset($_POST['interface']) &&
131 125
		    is_array($_POST['interface'])) {
132
			$config['dhcrelay6']['interface'] = implode(",",
133
			    $_POST['interface']);
126
			config_set_path('dhcrelay6/interface', implode(",", $_POST['interface']));
134 127
		} else {
135
			unset($config['dhcrelay6']['interface']);
128
			config_del_path('dhcrelay6/interface');
136 129
		}
137
		$config['dhcrelay6']['agentoption'] = $_POST['agentoption'] ? true : false;
138
		$config['dhcrelay6']['server'] = $svrlist;
139
		$config['dhcrelay6']['carpstatusvip'] = $_POST['carpstatusvip'];
130
		config_set_path('dhcrelay6/agentoption', $_POST['agentoption'] ? true : false);
131
		config_set_path('dhcrelay6/server', $svrlist);
132
		config_set_path('dhcrelay6/carpstatusvip', $_POST['carpstatusvip']);
140 133

  
141 134
		write_config("DHCPv6 Relay settings saved");
142 135

  

Also available in: Unified diff