Commit 0d3097ab authored by David Johnson's avatar David Johnson

Bugfix to network string generation; we were generating the broadcast addr.

parent 0eb8cdcf
......@@ -130,14 +130,14 @@ class IPAssign(object):
if netnum >= nextbasenum:
raise Exception("out of subnet space in /%d at network %s (/%d)"
% (basebits,name,bitsize))
networknum = netnum + (2 ** (32 - bitsize)) - 1
bcastnum = netnum + (2 ** (32 - bitsize)) - 1
netmask = 0
for i in range(32 - bitsize,32):
netmask |= (1 << i)
self.subnets[name] = {
'bits':bitsize,'netnum':netnum,
'networknum':networknum,
'networkstr':IPAssign.__htoa(networknum),
'networknum':netnum,'networkstr':IPAssign.__htoa(netnum),
'bcastnum':bcastnum,'bcaststr':IPAssign.__htoa(bcastnum),
'hostnum':0,'maxhosts':2 ** (32 - bitsize) - 1,'addrs':[],
'netmask':netmask,'netmaskstr':IPAssign.__htoa(netmask)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment