]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: remote: Handle different ifconfig output formats
authorJanusz Dziedzic <janusz.dziedzic@gmail.com>
Sun, 12 Jan 2020 22:02:19 +0000 (23:02 +0100)
committerJouni Malinen <j@w1.fi>
Sun, 23 Feb 2020 13:34:06 +0000 (15:34 +0200)
We could have different ifconfig output formats on the remote devices,
so make the parser more flexible to handle such cases.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
tests/remote/rutils.py

index 70ad82c877d878c9c905b0a3bde0ce4191ea982d..0acef42d1e7efaacf7dba451b173b646299c68e4 100644 (file)
@@ -239,6 +239,8 @@ def get_ipv6(client, ifname=None):
 
     for line in lines:
         res = line.find("Scope:Link")
+        if res == -1:
+            res = line.find("<link>")
         if res != -1:
             break
 
@@ -248,6 +250,8 @@ def get_ipv6(client, ifname=None):
             addr_mask = words[2]
             addr = addr_mask.split("/")
             return addr[0]
+        if words[0] == "inet6":
+            return words[1]
 
     return "unknown"
 
@@ -281,7 +285,7 @@ def get_mac_addr(host, iface=None):
     for word in words:
         if found == 1:
             return word
-        if word == "HWaddr":
+        if word == "HWaddr" or word == "ether":
             found = 1
     raise Exception("Could not find HWaddr")