projects
/
15.05
/
openwrt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8dcb4e5
)
base-files: ipcalc.sh: support bit length as netmask parameter
author
Jo-Philipp Wich
<jow@openwrt.org>
Mon, 16 Dec 2013 16:29:23 +0000
(16:29 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Mon, 16 Dec 2013 16:29:23 +0000
(16:29 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39100
3c298f89
-4303-0410-b956-
a3cf2f4a3e73
package/base-files/files/bin/ipcalc.sh
patch
|
blob
|
history
diff --git
a/package/base-files/files/bin/ipcalc.sh
b/package/base-files/files/bin/ipcalc.sh
index
27a52d6
..
5d5eac3
100755
(executable)
--- 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)