Changeset 7936 in genesis
- Timestamp:
- May 18, 2010, 6:33:07 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nodes/getrange.py
r7460 r7936 6 6 import re 7 7 import sys 8 import glob 8 9 9 10 size = 30 … … 16 17 numaddrs = 1 << (32 - size) 17 18 18 ipre = re.compile("^IP=(172\.16\.[0-9]+\.[0-9]+)/([0-9]+) *")19 substre = re.compile("^(\$[a-zA-Z][^ =]*) ?= ?'([^']*)';") 19 20 20 21 def parseaddr(s): … … 30 31 bezet = {} 31 32 32 (cout, cin) = popen2.popen2("cat */wleiden.conf | grep ^IP | grep 172.16\...*\/[24\|26\|28\|29\|30]") 33 cin.close() 34 for l in cout.readlines(): 35 l = l[:-1] 36 match = ipre.match(l) 37 if match == None: 38 #print "'" + l + "'" 39 continue 40 if len(match.groups()) == 0: 41 continue 42 addr = parseaddr(match.group(1)) 43 mask = int(match.group(2)) 44 addr = addr & ~((1 << (32 - mask)) - 1) 45 bezet[addr] = 1 33 for fname in glob.glob("*/wleiden.conf"): 34 substs = {} 35 for l in open(fname): 36 l = l[:-1] 37 match = substre.match(l) 38 if match != None: 39 substs[match.group(1)] = match.group(2) 40 if l.startswith("IP="): 41 right = l[3:] 42 if '/' not in right: 43 addr = right 44 mask = 32 45 else: 46 addr, mask = right.split('/') 47 if addr in substs: 48 addr = substs[addr] 49 addr = parseaddr(addr) 50 mask = int(mask) 51 addr = addr & ~((1 << (32 - mask)) - 1) 52 bezet[addr] = 1 46 53 47 54 i = 0xffffffffL
Note:
See TracChangeset
for help on using the changeset viewer.