index
:
openwrt.git
OpenWrt Source Repository
log msg
author
committer
range
feature/odhcpd_odhcp6c_udhcpc-capsdrop
linksys3200ac-master
master
about
summary
refs
log
tree
commit
diff
path:
root
/
package
diff options
context:
1
2
3
4
5
6
7
8
9
10
15
20
25
30
35
40
space:
include
ignore
mode:
unified
ssdiff
stat only
author
Jo-Philipp Wich <jow@openwrt.org>
2013-12-16 16:29:23 +0000
committer
Jo-Philipp Wich <jow@openwrt.org>
2013-12-16 16:29:23 +0000
commit
ef0ce72b39024942f236f81ab336d3a1b9269242
(
patch
)
tree
ef83fb28f52ddc67de3715c480863e2d95f2274d
/
package
parent
fe230cac1807fe6e595672d566e20d341211fbcf
(
diff
)
base-files: ipcalc.sh: support bit length as netmask parameter
SVN-Revision: 39100
Diffstat
(limited to 'package')
-rwxr-xr-x
package/base-files/files/bin/ipcalc.sh
6
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)