Skip to content

Commit 7f8381b

Browse files
util/agents/network_interface: handle wifis without SSID
Hidden wifis do not send an SSID. If a hidden wifi is in reach, the following error can be observed: Traceback (most recent call last): File "/path/to/labgrid/examples/networkmanager/nm.py", line 68, in <module> pprint(d.get_access_points()) ^^^^^^^^^^^^^^^^^^^^^ File "/path/to/labgrid/labgrid/binding.py", line 102, in wrapper return func(self, *_args, **_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/labgrid/labgrid/step.py", line 215, in wrapper _result = func(*_args, **_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/labgrid/labgrid/driver/networkinterfacedriver.py", line 126, in get_access_points return self.proxy.get_access_points(self.iface.ifname, scan) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/labgrid/labgrid/util/agentwrapper.py", line 29, in __call__ return self.wrapper.call(self.name, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/labgrid/labgrid/util/agentwrapper.py", line 106, in call raise AgentException(e) labgrid.util.agentwrapper.AgentException: AttributeError("'NoneType' object has no attribute 'get_data'") Fix that by retrieving the SSID only if it was received. The AP dict will not contain the "ssid" key if no SSID was received. Signed-off-by: Bastian Krause <[email protected]>
1 parent 5449331 commit 7f8381b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

labgrid/util/agents/network_interface.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ def _accesspoint_to_dict(self, ap):
192192
res["wpa-flags"] = self._flags_to_str(ap.get_wpa_flags())
193193
res["rsn-flags"] = self._flags_to_str(ap.get_rsn_flags())
194194
res["bssid"] = ap.get_bssid()
195-
res["ssid"] = ap.get_ssid().get_data().decode(errors="surrogateescape")
195+
if ap.get_ssid():
196+
res["ssid"] = ap.get_ssid().get_data().decode(errors="surrogateescape")
196197
res["frequency"] = ap.get_frequency()
197198
res["mode"] = self._flags_to_str(ap.get_mode())
198199
res["max-bitrate"] = ap.get_max_bitrate()

0 commit comments

Comments
 (0)