From: Leon M. George Date: Thu, 5 May 2022 21:47:47 +0000 (+0200) Subject: base-files: ipcalc.sh: don't include own address in range X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4fe106afd1870cfeb6a45d40f1dbb69e890f1756;p=openwrt%2Fstaging%2Fstintel.git base-files: ipcalc.sh: don't include own address in range Make sure our own address doesn't lie in the calculated range. Signed-off-by: Leon M. George --- diff --git a/package/base-files/files/bin/ipcalc.sh b/package/base-files/files/bin/ipcalc.sh index 9b2c4d2afc..66d37952de 100755 --- a/package/base-files/files/bin/ipcalc.sh +++ b/package/base-files/files/bin/ipcalc.sh @@ -61,10 +61,17 @@ BEGIN { start=or(network,and(ip2int(ARGV[3]),compl32(netmask))) limit=network+1 if (startlimit) end=limit + if (end==ipaddr) end=ipaddr-1 + + if (ipaddr > start && ipaddr < end) { + print "ipaddr inside range" > "/dev/stderr" + exit(1) + } print "START="int2ip(start) print "END="int2ip(end)