Project

General

Profile

« Previous | Next » 

Revision f6db0eef

Added by Chris Buechler almost 18 years ago

Do not allow DHCP server to be enabled when DHCP relay is enabled, and vice versa

Ticket #1488

View differences:

usr/local/www/services_dhcp.php
81 81

  
82 82
$ifcfg = $config['interfaces'][$if];
83 83

  
84
/*   set the enabled flag which will tell us if DHCP relay is enabled
85
 *   on any interface.   We will use this to disable DHCP server since
86
 *   the two are not compatible with each other.
87
 */
88

  
89
$dhcrelay_enabled = false;
90
$dhcrelaycfg = $config['dhcrelay'];
91

  
92
if(is_array($dhcrelaycfg)) {
93
	foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
94
		if (isset($dhcrelayifconf['enable']) &&
95
			(($dhcrelayif == "lan") ||
96
			(isset($config['interfaces'][$dhcrelayif]['enable']) &&
97
			$config['interfaces'][$dhcrelayif]['if'] && (!$config['interfaces'][$dhcrelayif]['bridge']))))
98
			$dhcrelay_enabled = true;
99
	}
100
}
101

  
102

  
84 103
if (!is_array($config['dhcpd'][$if]['staticmap'])) {
85 104
	$config['dhcpd'][$if]['staticmap'] = array();
86 105
}
......
310 329
<form action="services_dhcp.php" method="post" name="iform" id="iform">
311 330
<?php if ($input_errors) print_input_errors($input_errors); ?>
312 331
<?php if ($savemsg) print_info_box($savemsg); ?>
332
<?php 
333
	if ($dhcrelay_enabled) {
334
		echo "DHCP Relay is currently enabled.  Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.";
335
		include("fend.inc"); 
336
		echo "</body>";
337
		echo "</html>";
338
		exit;
339
	}
340
?>
313 341
<?php if (file_exists($d_staticmapsdirty_path)): ?><p>
314 342
<?php print_info_box_np("The static mapping configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
315 343
<?php endif; ?>
usr/local/www/services_dhcp_relay.php
88 88
 *   the two are not compatible with each other.
89 89
 */
90 90
$dhcpd_enabled = false;
91
foreach($config['dhcpd'] as $dhcp) 
92
	if($dhcp['enable']) $dhcpd_enabled = true;
91
foreach($config['dhcpd'] as $dhcp) {
92
	if(isset($dhcp['enable'])) $dhcpd_enabled = true;
93
}
93 94

  
94 95
if ($_POST) {
95 96

  
......
179 180
<?php if ($savemsg) print_info_box($savemsg); ?>
180 181
<?php 
181 182
	if ($dhcpd_enabled) {
182
		echo "DHCP Server is currently enabled.  Cannot display dhcp-relay service while DHCP Server is enabled on any interface.";
183
		echo "DHCP Server is currently enabled.  Cannot enable the DHCP Relay service while the DHCP Server is enabled on any interface.";
183 184
		include("fend.inc"); 
184 185
		echo "</body>";
185 186
		echo "</html>";

Also available in: Unified diff