mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
MVC/Firewall/Util - add CIDRToMask()
This commit is contained in:
parent
271525f00b
commit
d633cd961f
@ -339,6 +339,16 @@ class Util
|
||||
return md5(json_encode($rule));
|
||||
}
|
||||
|
||||
/**
|
||||
* convert ipv4 cidr to netmask e.g. 24 --> 255.255.255.0
|
||||
* @param int $bits ipv4 bits
|
||||
* @return string netmask
|
||||
*/
|
||||
public static function CIDRToMask($bits)
|
||||
{
|
||||
return long2ip(0xFFFFFFFF << (32 - $bits));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the smallest possible subnet mask for given IP range
|
||||
* @param array ips (start, end)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user