aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorLeon M. George <leon@georgemail.eu>2022-05-05 23:47:47 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2023-02-07 21:05:56 +0100
commit4fe106afd1870cfeb6a45d40f1dbb69e890f1756 (patch)
tree22dfabb17a3e5895707105fa81c8032b96ccbce8 /package
parent00a20335ba2bac4cc33048464ba4bab070309db7 (diff)
downloadupstream-4fe106afd1870cfeb6a45d40f1dbb69e890f1756.tar.gz
upstream-4fe106afd1870cfeb6a45d40f1dbb69e890f1756.tar.bz2
upstream-4fe106afd1870cfeb6a45d40f1dbb69e890f1756.zip
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 <leon@georgemail.eu>
Diffstat (limited to 'package')
-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)