From: Leon M. Busch-George Date: Fri, 16 Jun 2023 12:56:39 +0000 (+0200) Subject: base-files: ipcalc.sh: correctly set limit for prefix > 30 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9b2f8a33b6b247d4232d48a1d18aea3769590083;p=openwrt%2Fstaging%2Fthess.git base-files: ipcalc.sh: correctly set limit for prefix > 30 For /31 and /32 prefixes, there are only host addresses - no network and broadcast address with all-zero and all-one bits. Reflect this when setting the limit. Signed-off-by: Leon M. Busch-George --- diff --git a/package/base-files/files/bin/ipcalc.sh b/package/base-files/files/bin/ipcalc.sh index 21f84bcaf2..c852b5163f 100755 --- a/package/base-files/files/bin/ipcalc.sh +++ b/package/base-files/files/bin/ipcalc.sh @@ -64,13 +64,21 @@ BEGIN { if (ARGC <= 3) exit(0) + if (prefix<=30) + limit=network+1 + else + limit=network + start=or(network,and(ip2int(ARGV[3]),compl32(netmask))) - limit=network+1 if (startlimit) end=limit if (end==ipaddr) end=ipaddr-1