]> git.ipfire.org Git - people/jschlag/network.git/commitdiff
IPv4: Fix comparing IP addresses
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Sep 2016 16:39:52 +0000 (18:39 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Sep 2016 16:39:52 +0000 (18:39 +0200)
This function relied on an older function that was removed
some time ago.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.ipv4

index 799fe0099347f80ccf6ffcf9f8bc5dd0bb391bea..87a2fdba0abf5c08e59b4c9b960d53b6c4b8d0bf 100644 (file)
@@ -281,18 +281,12 @@ ipv4_addr_eq() {
 }
 
 ipv4_addr_gt() {
-       local addr1=${1}
-       assert isset addr1
-
-       local addr2=${2}
-       assert isset addr2
+       assert [ $# -eq 2 ]
 
-       local addr
-       for addr in addr1 addr2; do
-               printf -v ${addr} "%s" "$(ip_encode ${!addr})"
-       done
+       local addr1="${1}"
+       local addr2="${2}"
 
-       [[ ${addr1} -gt ${addr2} ]] \
+       inetcalc -4 -g "${addr1}" "${addr2}" \
                && return ${EXIT_TRUE} || return ${EXIT_FALSE}
 }