Revision fdb9c1db
Added by Warren Baker almost 14 years ago
etc/inc/util.inc | ||
---|---|---|
509 | 509 |
|
510 | 510 |
list($hp,$np) = explode('/', $subnet); |
511 | 511 |
|
512 |
if (!is_ipaddr($hp)) |
|
512 |
if (!is_ipaddrv4($hp))
|
|
513 | 513 |
return false; |
514 | 514 |
|
515 | 515 |
if (!is_numeric($np) || ($np < 1) || ($np > 32)) |
... | ... | |
518 | 518 |
return true; |
519 | 519 |
} |
520 | 520 |
|
521 |
/* returns true if $subnet is a valid IPv6 subnet in CIDR format */ |
|
522 |
function is_subnetv6($subnet) { |
|
523 |
if (!is_string($subnet)) |
|
524 |
return false; |
|
525 |
|
|
526 |
list($hp,$np) = explode('/', $subnet); |
|
527 |
|
|
528 |
if (!is_ipaddrv6($hp)) |
|
529 |
return false; |
|
530 |
|
|
531 |
if (!is_numeric($np) || ($np < 1) || ($np > 128)) |
|
532 |
return false; |
|
533 |
|
|
534 |
return true; |
|
535 |
} |
|
536 |
|
|
537 |
|
|
521 | 538 |
/* returns true if $subnet is a valid subnet in CIDR format or an alias thereof */ |
522 | 539 |
function is_subnetoralias($subnet) { |
523 | 540 |
global $aliastable; |
Also available in: Unified diff
Add is_subnetv6 for checking of IPv6 subnets