Project

General

Profile

« Previous | Next » 

Revision 3707ffc4

Added by Phil Davis over 8 years ago

DHCPV6 only check VIPs in range if range valid

If the user has input invalid values into range from and to, then there
is no point checking any IPv6 VIPs to see if they fall in the range.
None of them would be "in range" because the specified range is not even
valid.

View differences:

src/usr/local/www/services_dhcpv6.php
244 244
			}
245 245
		}
246 246

  
247
		$range_from_to_ok = true;
248

  
247 249
		if ($_POST['range_from']) {
248 250
			if (!is_ipaddrv6($_POST['range_from'])) {
249 251
				$input_errors[] = gettext("A valid range must be specified.");
252
				$range_from_to_ok = false;
250 253
			} elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6' &&
251 254
			    !Net_IPv6::isInNetmask($_POST['range_from'], '::', $ifcfgsn)) {
252 255
				$input_errors[] = sprintf(gettext(
253 256
				    "The prefix (upper %s bits) must be zero.  Use the form %s"),
254 257
				    $ifcfgsn, $str_help_mask);
258
				$range_from_to_ok = false;
255 259
			}
256 260
		}
257 261
		if ($_POST['range_to']) {
258 262
			if (!is_ipaddrv6($_POST['range_to'])) {
259 263
				$input_errors[] = gettext("A valid range must be specified.");
264
				$range_from_to_ok = false;
260 265
			} elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6' &&
261 266
			    !Net_IPv6::isInNetmask($_POST['range_to'], '::', $ifcfgsn)) {
262 267
				$input_errors[] = sprintf(gettext(
263 268
				    "The prefix (upper %s bits) must be zero.  Use the form %s"),
264 269
				    $ifcfgsn, $str_help_mask);
270
				$range_from_to_ok = false;
265 271
			}
266 272
		}
267 273
		if (($_POST['gateway'] && !is_ipaddrv6($_POST['gateway']))) {
......
314 320
		}
315 321

  
316 322
		// Disallow a range that includes the virtualip
317
		if (is_array($config['virtualip']['vip'])) {
323
		if ($range_from_to_ok && is_array($config['virtualip']['vip'])) {
318 324
			foreach ($config['virtualip']['vip'] as $vip) {
319 325
				if ($vip['interface'] == $if) {
320 326
					if ($vip['subnetv6'] && is_inrange_v6($vip['subnetv6'], $_POST['range_from'], $_POST['range_to'])) {

Also available in: Unified diff