summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon M. Busch-George2023-06-16 12:53:09 +0000
committerLeon M. Busch-George2023-09-25 13:02:49 +0000
commit9e8bbd4265271612732c0804065ce8bf4939e8c0 (patch)
tree1521e492c1c080c926b99109e6f61b545563e287
parent658549837282d0ca9decfdaf599fc67bf90418c6 (diff)
base-files: ipcalc.sh: correctly interpret num parameter
The start and end addresses are inclusive. Thus, adding num without substracting one results in num + 1 addresses. Add the substraction and to implement the documented behaviour. Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
-rwxr-xr-xpackage/base-files/files/bin/ipcalc.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/package/base-files/files/bin/ipcalc.sh b/package/base-files/files/bin/ipcalc.sh
index 56854b4104..21f84bcaf2 100755
--- a/package/base-files/files/bin/ipcalc.sh
+++ b/package/base-files/files/bin/ipcalc.sh
@@ -69,7 +69,7 @@ BEGIN {
if (start<limit) start=limit
if (start==ipaddr) start=ipaddr+1
- end=start+ARGV[4]
+ end=start+ARGV[4]-1
limit=or(network,compl32(netmask))-1
if (end>limit) end=limit
if (end==ipaddr) end=ipaddr-1