## a mask with N leading ones followed by trailing zeroes.
slash = net.index('/')
addr, = unpack('>L', S.inet_aton(net[:slash]))
- if net.find('.', slash + 1) >= 0:
- mask, = unpack('>L', S.inet_aton(net[:slash]))
- else:
+ if net[slash + 1:].isdigit():
n = int(net[slash + 1:], 10)
mask = (1 << 32) - (1 << 32 - n)
+ else:
+ mask, = unpack('>L', S.inet_aton(net[slash + 1:]))
pats.append((tag, peer, addr & mask, mask))
## Annoyingly, RawConfigParser doesn't preserve the order of options.