summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-12-16 16:29:23 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-12-16 16:29:23 +0000
commitec907455d3be7ec0200e229b7a5a57e931b3c7cd (patch)
treee2953ce191690344986ff9e588c3f047d1929d73 /package
parent2c5f724cea3f0dc50fd181425428ab6406fc92a7 (diff)
base-files: ipcalc.sh: support bit length as netmask parameter
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39100 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/bin/ipcalc.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/package/base-files/files/bin/ipcalc.sh b/package/base-files/files/bin/ipcalc.sh
index 27a52d6f83..5d5eac3ea8 100755
--- a/package/base-files/files/bin/ipcalc.sh
+++ b/package/base-files/files/bin/ipcalc.sh
@@ -31,7 +31,11 @@ BEGIN {
slpos=index(ARGV[1],"/")
if (slpos == 0) {
ipaddr=ip2int(ARGV[1])
- netmask=ip2int(ARGV[2])
+ dotpos=index(ARGV[2],".")
+ if (dotpos == 0)
+ netmask=compl32(2**(32-int(ARGV[2]))-1)
+ else
+ netmask=ip2int(ARGV[2])
} else {
ipaddr=ip2int(substr(ARGV[1],0,slpos-1))
netmask=compl32(2**(32-int(substr(ARGV[1],slpos+1)))-1)