mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-12-06 09:59:28 +00:00
global-functions: introduce $NetMask4
This commit is contained in:
parent
025b492783
commit
def540c965
1 changed files with 8 additions and 0 deletions
|
|
@ -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 ({});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue