summaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authorLeon M. Busch-George <leon@georgemail.eu>2023-06-16 14:53:09 +0200
committerLeon M. Busch-George <leon@georgemail.eu>2023-09-25 15:02:49 +0200
commit9e8bbd4265271612732c0804065ce8bf4939e8c0 (patch)
tree1521e492c1c080c926b99109e6f61b545563e287 /package/base-files
parent658549837282d0ca9decfdaf599fc67bf90418c6 (diff)
downloadopenwrt-9e8bbd4265271612732c0804065ce8bf4939e8c0.tar.gz
openwrt-9e8bbd4265271612732c0804065ce8bf4939e8c0.tar.bz2
openwrt-9e8bbd4265271612732c0804065ce8bf4939e8c0.zip
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>
Diffstat (limited to 'package/base-files')
-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