Project

General

Profile

« Previous | Next » 

Revision 20dda766

Added by Renato Botelho over 11 years ago

Prevent network or broadcast address to be set on interface (console, GUI and wizard). It should fix #3196

View differences:

etc/rc.initial.setlanip
283 283
				echo "\n" . sprintf(gettext("Enter the new %s %s subnet bit count:"),
284 284
				                    $upperifname, $label_IPvX) . "\n> ";
285 285
				$intbits = chop(fgets($fp));
286
				$intbits_ok = is_numeric($intbits) && (($intbits >= 1) || ($intbits <= $maxbits));
286 287
				$restart_dhcpd = true;
287
			} while (!is_numeric($intbits) || ($intbits < 1) || ($intbits > $maxbits));
288

  
289
				if ($version === 4 && $intbits < $maxbits) {
290
					if ($intip == gen_subnet($intip, $intbits)) {
291
						echo gettext("You cannot set network address to an interface");
292
						$intbits_ok = false;
293
					} else if ($intip == gen_subnet_max($intip, $intbits)) {
294
						echo gettext("You cannot set broadcast address to an interface");
295
						$intbits_ok = false;
296
					}
297
				}
298
			} while (!$intbits_ok);
288 299

  
289 300
			if ($version === 6) {
290 301
				$subnet = gen_subnetv6($intip, $intbits);

Also available in: Unified diff