awk has "issues" with unsigned math
authorMike Baker <mbm@openwrt.org>
Sat, 25 Mar 2006 07:35:07 +0000 (07:35 +0000)
committerMike Baker <mbm@openwrt.org>
Sat, 25 Mar 2006 07:35:07 +0000 (07:35 +0000)
SVN-Revision: 3475

openwrt/package/base-files/default/bin/ipcalc

index 9c48354494cb19d026fca125e04d3ffa4d86e51a..7a9c6077754df7a1b5876a4f478f93bcfb2e441a 100755 (executable)
@@ -19,7 +19,7 @@ BEGIN {
        print "NETMASK="int2ip(netmask)
        print "BROADCAST="int2ip(broadcast)
        print "NETWORK="int2ip(network)
-       print "PREFIX="bitcount(int2ip(netmask))
+       print "PREFIX="32-bitcount(compl(netmask))
        
        # range calculations:
        # ipcalc <ip> <netmask> <start> <num>