mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-12-06 18:09: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 MAX;
|
||||||
:global MIN;
|
:global MIN;
|
||||||
:global MkDir;
|
:global MkDir;
|
||||||
|
:global NetMask4;
|
||||||
:global NotificationFunctions;
|
:global NotificationFunctions;
|
||||||
:global ParseDate;
|
:global ParseDate;
|
||||||
:global ParseKeyValueStore;
|
:global ParseKeyValueStore;
|
||||||
|
|
@ -990,6 +991,13 @@
|
||||||
:return true;
|
: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
|
# prepare NotificationFunctions array
|
||||||
:if ([ :typeof $NotificationFunctions ] != "array") do={
|
:if ([ :typeof $NotificationFunctions ] != "array") do={
|
||||||
:set NotificationFunctions ({});
|
:set NotificationFunctions ({});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue