From 4fe106afd1870cfeb6a45d40f1dbb69e890f1756 Mon Sep 17 00:00:00 2001 From: "Leon M. George" Date: Thu, 5 May 2022 23:47:47 +0200 Subject: 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 --- package/base-files/files/bin/ipcalc.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'package/base-files') 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) -- cgit v1.2.3