Changeset 10795 in hybrid for branches/releng-9.0/nanobsd/files/usr/local
- Timestamp:
- May 12, 2012, 4:38:21 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/releng-9.0/nanobsd/files/usr/local/www/wlportal/index.cgi
r10794 r10795 92 92 """ Find out the MAC for a certain IP address """ 93 93 try: 94 return subprocess.check_output(['/usr/sbin/arp', '-n' ,ipaddr], shell=False).split()[3][1:-1] 94 # ? (172.17.32.1) at 00:12:34:45:67:90 on ue0 permanent [ethernet] 95 return subprocess.check_output(['/usr/sbin/arp', '-n' ,ipaddr], shell=False).split()[3] 95 96 except subprocess.CalledProcessError: 96 97 raise MACnotFound … … 98 99 def get_active_MACs(): 99 100 """ Return dictionary with active IPs as keys """ 101 # ? (172.17.32.1) at 00:12:34:45:67:90 on ue0 permanent [ethernet] 102 # ? (172.17.32.2) at 00:aa:bb:cc:dd:ee on ue0 expires in 964 seconds [ethernet] 103 # ? (172.16.3.38) at (incomplete) on vr2 expired [ethernet] 100 104 output = subprocess.check_output(['/usr/sbin/arp', '-n' ,'-a'], shell=False) 101 105 db = {} 102 106 for line in output.strip().split('\n'): 103 107 i = line.split() 104 mac = i[3] [1:-1]105 ip = i[5] 108 mac = i[3] 109 ip = i[5][1:-1] 106 110 db[ip] = mac 107 111 return db
Note:
See TracChangeset
for help on using the changeset viewer.