base-files: fix ipcalc bound calculation for /31 prefix
authorLeon M. Busch-George <leon@georgemail.eu>
Thu, 9 May 2024 09:32:26 +0000 (11:32 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Mon, 17 Jun 2024 11:45:37 +0000 (13:45 +0200)
A small regress from the translation to shell.
Fixes #12921, originally fixed in #12925 (Github).

Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
Link: https://github.com/openwrt/openwrt/pull/15430
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
package/base-files/files/bin/ipcalc.sh

index 9e2702c60d2216cf365d05c7e500266fe3298201..ae7a5c9598814f37cd487c4f240ee6ad0a717d6a 100755 (executable)
@@ -111,6 +111,8 @@ start=$((network | (start & hostmask)))
 
 if [ "$prefix" -le 30 ]; then
     upper=$(((network | hostmask) - 1))
+elif [ "$prefix" -eq 31 ]; then
+    upper=$((network | hostmask))
 else
     upper="$network"
 fi