]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Strip trailing space from ip output
authorBenjamin Berg <benjamin.berg@intel.com>
Mon, 25 Dec 2023 10:20:58 +0000 (12:20 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 13 Jan 2024 17:47:23 +0000 (19:47 +0200)
It seems that the messages from ip may have a trailing space in some
cases, which may break matching in surrounding logic. Strip the output
to remove whitespace and avoid any issues this may cause.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
tests/hwsim/test_ap_hs20.py

index 1884bcb8dcb2af81e9ef9f8aa4ac253154cc0b5a..afb54c5d5401604b72fdcda2a4621bc5aa0ece3c 100644 (file)
@@ -4766,7 +4766,7 @@ def get_permanent_neighbors(ifname):
     cmd = subprocess.Popen(['ip', 'nei'], stdout=subprocess.PIPE)
     res = cmd.stdout.read().decode()
     cmd.stdout.close()
-    return [line for line in res.splitlines() if "PERMANENT" in line and ifname in line]
+    return [line.strip() for line in res.splitlines() if "PERMANENT" in line and ifname in line]
 
 def get_bridge_macs(ifname):
     cmd = subprocess.Popen(['brctl', 'showmacs', ifname],