Browse Source

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 <[email protected]>
Leon M. Busch-George 2 years ago
parent
commit
9e8bbd4265
1 changed files with 1 additions and 1 deletions
  1. 1 1
      package/base-files/files/bin/ipcalc.sh

+ 1 - 1
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