]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commit
network-functions.pl: Introduce convert_to_cidr_or_mask() function.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sat, 17 Jul 2021 19:30:15 +0000 (21:30 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 18 Jul 2021 09:29:30 +0000 (11:29 +0200)
commit79148bda2ca83ca4821fd10b28b7fb815aca76b6
treec3bc617c754fe8eaae28e9c18c10d884a950a400
parent839bc5527a236db38ea234633e3cff1215259a97
network-functions.pl: Introduce convert_to_cidr_or_mask() function.

This function is used to convert a single host address or network into
different formats.

If a single host address is given, it will be converted
to a plain address without any notation details.

When a single host address is given and a format is specified ("cidr"
or "mask") the host address with the notation details will be returned.

In case a network is given the output will be formated into the desired
format ("cidr" or "mask"). Unless a special output format is given for
a network it defaults to CIDR.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/network-functions.pl