2 # Copyright (C) 2006 OpenWrt.org
4 awk -f /usr
/lib
/common.
awk -f - $
* <<EOF
7 netmask=ip2int(ARGV[2])
8 network=and(ipaddr,netmask)
9 broadcast=or(network,compl(netmask))
11 start=or(network,and(ip2int(ARGV[3]),compl(netmask)))
13 if (start<limit) start=limit
16 limit=or(network,compl(netmask))-1
17 if (end>limit) end=limit
19 print "IP="int2ip(ipaddr)
20 print "NETMASK="int2ip(netmask)
21 print "BROADCAST="int2ip(broadcast)
22 print "NETWORK="int2ip(network)
23 print "PREFIX="32-bitcount(compl(netmask))
26 # ipcalc <ip> <netmask> <start> <num>
29 print "START="int2ip(start)
30 print "END="int2ip(end)
This page took 0.051728 seconds and 5 git commands to generate.