From: Michael Tremer Date: Thu, 8 Sep 2016 16:39:52 +0000 (+0200) Subject: IPv4: Fix comparing IP addresses X-Git-Tag: 009~289 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb7e1b00545295dfe3a915f9082dbbdbb3fea491;p=network.git IPv4: Fix comparing IP addresses This function relied on an older function that was removed some time ago. Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.ipv4 b/src/functions/functions.ipv4 index 799fe009..87a2fdba 100644 --- a/src/functions/functions.ipv4 +++ b/src/functions/functions.ipv4 @@ -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} }