diff options
author | Leon M. George <leon@georgemail.eu> | 2022-05-05 23:47:47 +0200 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2023-02-07 21:05:56 +0100 |
commit | 4fe106afd1870cfeb6a45d40f1dbb69e890f1756 (patch) | |
tree | 22dfabb17a3e5895707105fa81c8032b96ccbce8 /package | |
parent | 00a20335ba2bac4cc33048464ba4bab070309db7 (diff) | |
download | upstream-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-x | package/base-files/files/bin/ipcalc.sh | 7 |
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) |