doc: document AP properties PairwiseCiphers/GroupCipher
PATCH 1/4 doc: document AP properties PairwiseCiphers/GroupCipher
--- doc/access-point-api.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+)
doc/access-point-api.txt +13 -0
@@ -71,3 +71,16 @@ Properties boolean Started [readonly] uint32 Frequency [readonly, optional] The frequency that the Access Point is operating on. + + string PairwiseCiphers [readonly, optional] + + Comma separated list of pairwise ciphers the access + point supports. The same format as setting a list of + ciphers for an AP profile, i.e. TKIP, CCMP-128, + GCMP-128, CCMP-256, GCMP-256 etc. + + string GroupCipher [readonly, optional] + + The group cipher suite the access point is using. + Possible values are the same as what could be included + in the PairwiseCiphers list.
Signature · 1 line
2.34.3
PATCH 2/4 ap: update Scanning property when AP starts
This wasn't being updated meaning the property is missing until a scan is issued over DBus.
Rather than duplicate all the property changed calls they were all factored out into a helper function.
--- src/ap.c | 55 +++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 30 deletions(-)
v2:
* Fixed build problem that didn't make it into v1
src/ap.c +25 -30
@@ -3672,6 +3672,28 @@ struct ap_if_data {struct l_dbus_message *pending; }; +static void ap_properties_changed (struct ap_if_data *ap_if) +{ +l_dbus_property_changed (dbus_get_bus (), +netdev_get_path (ap_if->netdev), +IWD_AP_INTERFACE ,"Started" ); +l_dbus_property_changed (dbus_get_bus (), +netdev_get_path (ap_if->netdev), +IWD_AP_INTERFACE ,"Name" ); +l_dbus_property_changed (dbus_get_bus (), +netdev_get_path (ap_if->netdev), +IWD_AP_INTERFACE ,"Frequency" ); +l_dbus_property_changed (dbus_get_bus (), +netdev_get_path (ap_if->netdev), +IWD_AP_INTERFACE ,"PairwiseCiphers" ); +l_dbus_property_changed (dbus_get_bus (), +netdev_get_path (ap_if->netdev), +IWD_AP_INTERFACE ,"GroupCipher" ); +l_dbus_property_changed (dbus_get_bus (), +netdev_get_path (ap_if->netdev), +IWD_AP_INTERFACE ,"Scanning" ); +} +static void ap_if_event_func (enum ap_event_type type,const void *event_data,void *user_data) {
@@ -3703,21 +3725,8 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data, reply =l_dbus_message_new_method_return (ap_if->pending);dbus_pending_reply (&ap_if->pending, reply); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"Started" ); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"Name" ); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"Frequency" ); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"PairwiseCiphers" ); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"GroupCipher" ); + +ap_properties_changed (ap_if); l_rtnl_set_linkmode_and_operstate(rtnl, netdev_get_ifindex(ap_if->netdev),
@@ -3730,21 +3739,7 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data,netdev_get_path (ap_if->netdev), IWD_AP_DIAGNOSTIC_INTERFACE); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"Started" ); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"Name" ); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"Frequency" ); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"PairwiseCiphers" ); -l_dbus_property_changed (dbus_get_bus (), -netdev_get_path (ap_if->netdev), -IWD_AP_INTERFACE ,"GroupCipher" ); +ap_properties_changed (ap_if); l_rtnl_set_linkmode_and_operstate(rtnl, netdev_get_ifindex(ap_if->netdev),
Signature · 1 line
2.34.3
PATCH 3/4 auto-t: iwd.py: allow certain APIs to be used in AP mode
In reply to James PrestwoodAP mode implements a few DBus methods/properties which are named the same as station: Scan, Scanning, and GetOrderedNetworks. Allow the Device object to work with these in AP mode by calling the correct method if the Mode is 'ap'.
--- autotests/util/iwd.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
autotests/util/iwd.py +16 -8
@@ -521,13 +521,16 @@ class Device(IWDDBusAbstract): def scanning(self): ''' Reflects whether the device is currently scanning - for networks. net.connman.iwd.Network objects are - updated when this property goes from true to false. + for networks. For station devices net.connman.iwd.Network + objects are updated when this property goes from true to false @rtype: boolean ''' - props = self._station_properties() - return bool(props['Scanning']) + if self._properties['Mode'] == 'station': + props = self._station_properties() + return bool(props['Scanning']) + else: + return bool(self._ap.scanning) @property def autoconnect(self):
@@ -544,12 +547,14 @@ class Device(IWDDBusAbstract): Possible exception: BusyEx FailedEx ''' - self._iface.Scan(dbus_interface=IWD_STATION_INTERFACE, + if self._properties['Mode'] == 'station': + self._iface.Scan(dbus_interface=IWD_STATION_INTERFACE, reply_handler=self._success, error_handler=self._failure) - - if wait: - self._wait_for_async_op() + if wait: + self._wait_for_async_op() + else: + self._ap.scan() def disconnect(self): '''Disconnect from the network
@@ -576,6 +581,9 @@ class Device(IWDDBusAbstract): groups the maximum relative signal-strength is the main sorting factor. ''' + if self._properties['Mode'] == 'ap': + return self._ap.get_ordered_networks() + ordered_networks = [] if not full_scan: for bus_obj in self._station.GetOrderedNetworks():
Signature · 1 line
2.34.3
PATCH 4/4 auto-t: add test for scanning in AP mode
In reply to James Prestwood--- autotests/testAP/scan_test.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 autotests/testAP/scan_test.py
autotests/testAP/scan_test.py new file +20 -0
@@ -0,0 +1,20 @@ +#! /usr/bin/python3 + +import unittest + +from iwd import IWD + +class Test(unittest.TestCase): + def test_ap_scan(self): + wd = IWD(True) + + dev = wd.list_devices(1)[0] + + dev.start_ap('TestAP2', 'Password2') + + dev.scan() + + networks = dev.get_ordered_networks() + + self.assertTrue(len(networks) == 1) + self.assertTrue(networks[0]['Name'] == 'TestAP1')
Signature · 1 line
2.34.3
Hi James,
Quoted 9 lines
---
doc/access-point-api.txt| 13 +++++++++++++1 file changed, 13 insertions(+)doc/access-point-api.txt +0
-0
doc/access-point-api.txt Properties boolean Started [readonly] · line 80
Quoted 10 lines
doc/access-point-api.txt +7
-0@@ -71,3 +71,16 @@ Properties boolean Started [readonly] uint32 Frequency [readonly, optional] The frequency that the Access Point is operating on. + + string PairwiseCiphers [readonly, optional] + + Comma separated list of pairwise ciphers the access + point supports. The same format as setting a list of + ciphers for an AP profile, i.e. TKIP, CCMP-128, + GCMP-128, CCMP-256, GCMP-256 etc.
why not array{string} since that makes it a cleaner from an API point of view.
Regards
Marcel
Quoted 13 lines · Marcel Holtmann
Hi James,
Quoted 11 lines
---
doc/access-point-api.txt| 13 +++++++++++++1 file changed, 13 insertions(+)doc/access-point-api.txt +0
-0@@ -71,3 +71,16 @@ Properties boolean Started [readonly]uint32 Frequency [readonly, optional]
Quoted 15 lines
Quoted 6 lines
The frequency that the Access Point is operating on.
doc/access-point-api.txt +4
-0+ + string PairwiseCiphers [readonly, optional] + + Comma separated list of pairwise ciphersQuoted 6 lines
the access
+ point supports. The same format as setting a list of
+ ciphers for an AP profile, i.e. TKIP, CCMP-128,
+ GCMP-128, CCMP-256, GCMP-256 etc.why not array{string} since that makes it a cleaner from an API point of view.
We could do this yes. The implemenation has already been merged but we could change this to an array easy enough.
Quoted 5 lines
Regards
Marcel
Hi James,
Quoted 2 lines
Quoted 2 lines
why not array{string} since that makes it a cleaner from an API point of view.
Yeah, I concur this would be better.
Quoted 4 lines
We could do this yes. The implemenation has already been merged but we could change this to an array easy enough.
Yep, lets do that.
Regards,
-Denis