ASUSWRT: Add IPv6 support when parsing neighbors (#5536)
* ASUSWRT: Add IPv6 support when parsing neighbors The regex for IPv6 should cover most cases, but it doesn't validate whether IP is correct. It also might fail for some edge cases. Also, ignore 'duid xx:xx:xx:xx:xx:xx:xx:xx:xx:xx' line in leases. Closes #2814 - ASUSWRT doesn't support ipv6 * Update asuswrt.py
This commit is contained in:
parent
c7ff7af39d
commit
ca1dc202f9
1 changed files with 7 additions and 4 deletions
|
@ -71,10 +71,11 @@ _ARP_REGEX = re.compile(
|
|||
|
||||
_IP_NEIGH_CMD = 'ip neigh'
|
||||
_IP_NEIGH_REGEX = re.compile(
|
||||
r'(?P<ip>([0-9]{1,3}[\.]){3}[0-9]{1,3})\s' +
|
||||
r'\w+\s' +
|
||||
r'\w+\s' +
|
||||
r'(\w+\s(?P<mac>(([0-9a-f]{2}[:-]){5}([0-9a-f]{2}))))?\s' +
|
||||
r'(?P<ip>([0-9]{1,3}[\.]){3}[0-9]{1,3}|'
|
||||
r'([0-9a-fA-F]{1,4}:){1,7}[0-9a-fA-F]{0,4}(:[0-9a-fA-F]{1,4}){1,7})\s'
|
||||
r'\w+\s'
|
||||
r'\w+\s'
|
||||
r'(\w+\s(?P<mac>(([0-9a-f]{2}[:-]){5}([0-9a-f]{2}))))?\s'
|
||||
r'(?P<status>(\w+))')
|
||||
|
||||
_NVRAM_CMD = 'nvram get client_info_tmp'
|
||||
|
@ -323,6 +324,8 @@ class AsusWrtDeviceScanner(DeviceScanner):
|
|||
|
||||
else:
|
||||
for lease in result.leases:
|
||||
if lease.startswith(b'duid '):
|
||||
continue
|
||||
match = _LEASES_REGEX.search(lease.decode('utf-8'))
|
||||
|
||||
if not match:
|
||||
|
|
Loading…
Add table
Reference in a new issue