3 awk -f /usr
/lib
/common.
awk -f - $
* <<EOF
6 netmask=ip2int(ARGV[2])
7 network=and(ipaddr,netmask)
8 broadcast=or(network,compl(netmask))
10 start=or(network,and(ip2int(ARGV[3]),compl(netmask)))
12 if (start<limit) start=limit
15 limit=or(network,compl(netmask))-1
16 if (end>limit) end=limit
18 print "IP="int2ip(ipaddr)
19 print "NETMASK="int2ip(netmask)
20 print "BROADCAST="int2ip(broadcast)
21 print "NETWORK="int2ip(network)
22 print "PREFIX="32-bitcount(compl(netmask))
25 # ipcalc <ip> <netmask> <start> <num>
28 print "START="int2ip(start)
29 print "END="int2ip(end-1)
This page took 0.046801 seconds and 5 git commands to generate.