From 737e9e1037143989ac7ac6259de9ecb5d7cdd0e0 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 20 Mar 2024 17:19:50 +0100 Subject: [PATCH] network-functions.pl: Add function to get netmask in dotted format Signed-off-by: Michael Tremer --- config/cfgroot/network-functions.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; -- 2.39.5