]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
network-functions.pl: Add function to get netmask in dotted format
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 20 Mar 2024 16:19:50 +0000 (17:19 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 27 Apr 2024 17:30:44 +0000 (19:30 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/network-functions.pl

index 28b7af9eb1e501fd1845aed0744c281bc7571f54..507e85c2398d746faefffa4ec3a3b01bff3c24a2 100644 (file)
@@ -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;