diff options
author | jim-p <jimp@pfsense.org> | 2016-03-03 17:16:38 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2016-03-03 17:16:38 -0500 |
commit | 31b151809d04c40fd915c129d28cc9b440a0eabe (patch) | |
tree | dd77c564fa3ff1ea8710dc438df0a51d6f47f892 /src/etc/inc/util.inc | |
parent | 12d7d9e71e85308daeebf9533700d37f14fcc41b (diff) | |
download | pfsense-31b151809d04c40fd915c129d28cc9b440a0eabe.zip pfsense-31b151809d04c40fd915c129d28cc9b440a0eabe.tar.gz |
Move NTP access restrictions to their own tab and add the ability to craft custom restrictions for arbitrary networks. Fixes #4463
Diffstat (limited to 'src/etc/inc/util.inc')
-rw-r--r-- | src/etc/inc/util.inc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index e1f5c80..e74dc64 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -425,6 +425,16 @@ function gen_subnet_mask($bits) { return long2ip(gen_subnet_mask_long($bits)); } +/* Convert a prefix length to an IPv6 address-like mask notation. Very rare but at least ntp needs it. See #4463 */ +function gen_subnet_mask_v6($bits) { + /* Binary representation of the prefix length */ + $bin = str_repeat('1', $bits); + /* Pad right with zeroes to reach the full address length */ + $bin = str_pad($bin, 128, '0', STR_PAD_RIGHT); + /* Convert back to an IPv6 address style notation */ + return Net_IPv6::_bin2Ip($bin); +} + /* Convert long int to IPv4 address Returns '' if not valid IPv4 (including if any bits >32 are non-zero) */ function long2ip32($ip) { |