From: Michael Tremer Date: Wed, 20 Mar 2024 16:19:50 +0000 (+0100) Subject: network-functions.pl: Add function to get netmask in dotted format X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=737e9e1037143989ac7ac6259de9ecb5d7cdd0e0;p=people%2Fms%2Fipfire-2.x.git network-functions.pl: Add function to get netmask in dotted format Signed-off-by: Michael Tremer --- diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl index 28b7af9eb..507e85c23 100644 --- a/config/cfgroot/network-functions.pl +++ b/config/cfgroot/network-functions.pl @@ -318,6 +318,16 @@ sub get_prefix($) { return undef; } +sub get_netmask($) { + my $network = shift; + + # Fetch the prefix + my $prefix = &get_prefix($network); + + # Convert to netmask + return &convert_prefix2netmask($prefix); +} + # Returns True if $address is in $network. sub ip_address_in_network($$) { my $address = shift;