global-functions: introduce $NetMask4

This commit is contained in:
Christian Hesse 2025-10-16 10:26:50 +02:00
parent 025b492783
commit def540c965

View file

@ -61,6 +61,7 @@
:global MAX;
:global MIN;
:global MkDir;
:global NetMask4;
:global NotificationFunctions;
:global ParseDate;
:global ParseKeyValueStore;
@ -990,6 +991,13 @@
:return true;
}
# return an IPv4 netmask for CIDR
:set NetMask4 do={
:local CIDR [ :tonum $1 ];
:return ((255.255.255.255 << (32 - $CIDR)) & 255.255.255.255);
}
# prepare NotificationFunctions array
:if ([ :typeof $NotificationFunctions ] != "array") do={
:set NotificationFunctions ({});