Skip to content
Permalink
Browse files

Fix last commit logic.

  • Loading branch information...
respawner committed May 17, 2019
1 parent 89f3572 commit 3b32f03ae71d6428824b9dfb10d36dc7dd552d3a
Showing with 7 additions and 5 deletions.
  1. +1 −1 docs/configuration.md
  2. +6 −4 includes/utils.php
@@ -308,7 +308,7 @@ $config['misc']['minimum_prefix_length']['ipv6'] = 0;
$config['misc']['minimum_prefix_length']['ipv4'] = 0;
```
Set the minimum prefix length for route lookup. If set to 0, the prefix length
will not be checked. If the value is greater than zero and greater than the
will not be checked. If the value is greater than zero and lesser than the
prefix length for the route given by the user, an error will be displayed.

### Tools
@@ -81,8 +81,9 @@ function match_ipv6($ip, $ip_only = true) {
return false;
}
if (($config['minimum_prefix_length']['ipv6'] > 0) &&
(intval($ip_and_mask[1]) > $config['minimum_prefix_length']['ipv6'])) {
$min_prefix_length = $config['minimum_prefix_length']['ipv6'];
$prefix_length = intval($ip_and_mask[1]);
if (($min_prefix_length > 0) && ($prefix_length < $min_prefix_length)) {
return false;
}
@@ -129,8 +130,9 @@ function match_ipv4($ip, $ip_only = true) {
return false;
}
if (($config['minimum_prefix_length']['ipv4'] > 0) &&
(intval($ip_and_mask[1]) > $config['minimum_prefix_length']['ipv4'])) {
$min_prefix_length = $config['minimum_prefix_length']['ipv4'];
$prefix_length = intval($ip_and_mask[1]);
if (($min_prefix_length > 0) && ($prefix_length < $min_prefix_length)) {
return false;
}

0 comments on commit 3b32f03

Please sign in to comment.
You can’t perform that action at this time.