aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuta SATOH <nigoro.gentoo@0x100.com>2013-03-08 15:16:21 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2013-03-08 15:30:36 -0600
commitf1ae8963c9251c23752e932eede36bf6f8901dbf (patch)
tree8a705397c99f68ba1f50abe35ebd313540c43065
parent3b05586a735f46bb668a88e7ea59b1ff9d84b461 (diff)
oldnet: convert netmask to decimal numbers in _netmask2cidr
Free BSD's ifconfig outputs a netmask in the form 0xffffff00, which was translating to 0xff.0xff.0xff.0x00,. Now we convert this to decimal numbers before we convert it to cidr notation. Reported-by: 4glitch@gmail.com X-Gentoo-Bug: 460268 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=460268
-rw-r--r--init.d/net.lo.in3
1 files changed, 3 insertions, 0 deletions
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 95744f8b..cc3bfd03 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -151,6 +151,9 @@ _netmask2cidr()
local i= len=
local IFS=.
for i in $1; do
+ case $i in
+ 0x*) i=$((i)) ;;
+ esac
while [ ${i} -ne 0 ]; do
: $(( len += i % 2 ))
: $(( i >>= 1 ))