PVE::Network: add some common constants

added ipv4_reverse_mask and ipv4_mask_hash_localnet as they
are used in several places.
This commit is contained in:
Wolfgang Bumiller 2015-07-09 08:47:08 +02:00 committed by Dietmar Maurer
parent 9030a7d7f6
commit 61aa94e472

View File

@ -9,6 +9,60 @@ use File::Basename;
# host network related utility functions
our $ipv4_reverse_mask = [
'0.0.0.0',
'128.0.0.0',
'192.0.0.0',
'224.0.0.0',
'240.0.0.0',
'248.0.0.0',
'252.0.0.0',
'254.0.0.0',
'255.0.0.0',
'255.128.0.0',
'255.192.0.0',
'255.224.0.0',
'255.240.0.0',
'255.248.0.0',
'255.252.0.0',
'255.254.0.0',
'255.255.0.0',
'255.255.128.0',
'255.255.192.0',
'255.255.224.0',
'255.255.240.0',
'255.255.248.0',
'255.255.252.0',
'255.255.254.0',
'255.255.255.0',
'255.255.255.128',
'255.255.255.192',
'255.255.255.224',
'255.255.255.240',
'255.255.255.248',
'255.255.255.252',
'255.255.255.254',
'255.255.255.255',
];
our $ipv4_mask_hash_localnet = {
'255.255.0.0' => 16,
'255.255.128.0' => 17,
'255.255.192.0' => 18,
'255.255.224.0' => 19,
'255.255.240.0' => 20,
'255.255.248.0' => 21,
'255.255.252.0' => 22,
'255.255.254.0' => 23,
'255.255.255.0' => 24,
'255.255.255.128' => 25,
'255.255.255.192' => 26,
'255.255.255.224' => 27,
'255.255.255.240' => 28,
'255.255.255.248' => 29,
'255.255.255.252' => 30,
};
sub setup_tc_rate_limit {
my ($iface, $rate, $burst, $debug) = @_;