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>
This commit is contained in:
Leon M. Busch-George 2023-06-16 14:53:09 +02:00
parent 6585498372
commit 9e8bbd4265

View File

@ -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