aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/bin/ipcalc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/files/bin/ipcalc.sh')
-rwxr-xr-xpackage/base-files/files/bin/ipcalc.sh7
1 files changed, 7 insertions, 0 deletions
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 (start<limit) start=limit
+ if (start==ipaddr) start=ipaddr+1
end=start+ARGV[4]
limit=or(network,compl32(netmask))-1
if (end>limit) 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)