]> git.ipfire.org Git - network.git/blobdiff - functions.ipv4
Fix setting local routes on zone's routing tables.
[network.git] / functions.ipv4
index 678b1e7334287d76094bc62631802b8d40e6a9be..d074ca940ab35408876d6be8e446d445b5ec20a3 100644 (file)
@@ -57,3 +57,19 @@ function ipv4_update_neighbours() {
        arping -q -A -c 1 -I ${device} ${address}
        ( sleep 2; arping -q -U -c 1 -I ${device} ${address} ) >/dev/null 2>&1 </dev/null &
 }
+
+function ipv4_get_netaddress() {
+       local address=${1}
+       assert isset address
+
+       local prefix=$(ip_get_prefix ${address})
+       assert isset prefix
+
+       local NETWORK
+       eval $(ipcalc --network ${address})
+       assert isset NETWORK
+
+       echo "${NETWORK}/${prefix}"
+
+       return ${EXIT_OK}
+}