All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher
@ 2022-11-03 17:30 James Prestwood
  2022-11-03 17:30 ` [PATCH 2/4] ap: update Scanning property when AP starts James Prestwood
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: James Prestwood @ 2022-11-03 17:30 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

---
 doc/access-point-api.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/doc/access-point-api.txt b/doc/access-point-api.txt
index 63e61d49..28e6437d 100644
--- a/doc/access-point-api.txt
+++ b/doc/access-point-api.txt
@@ -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.
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] ap: update Scanning property when AP starts
  2022-11-03 17:30 [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher James Prestwood
@ 2022-11-03 17:30 ` James Prestwood
  2022-11-03 17:30 ` [PATCH 3/4] auto-t: iwd.py: allow certain APIs to be used in AP mode James Prestwood
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-11-03 17:30 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

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

diff --git a/src/ap.c b/src/ap.c
index 9c82a545..665c1857 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -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),
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] auto-t: iwd.py: allow certain APIs to be used in AP mode
  2022-11-03 17:30 [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher James Prestwood
  2022-11-03 17:30 ` [PATCH 2/4] ap: update Scanning property when AP starts James Prestwood
@ 2022-11-03 17:30 ` James Prestwood
  2022-11-03 17:30 ` [PATCH 4/4] auto-t: add test for scanning " James Prestwood
  2022-11-03 18:17 ` [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher Marcel Holtmann
  3 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-11-03 17:30 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

AP 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(-)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 98b9ea1c..5fa12444 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -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():
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] auto-t: add test for scanning in AP mode
  2022-11-03 17:30 [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher James Prestwood
  2022-11-03 17:30 ` [PATCH 2/4] ap: update Scanning property when AP starts James Prestwood
  2022-11-03 17:30 ` [PATCH 3/4] auto-t: iwd.py: allow certain APIs to be used in AP mode James Prestwood
@ 2022-11-03 17:30 ` James Prestwood
  2022-11-03 18:17 ` [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher Marcel Holtmann
  3 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-11-03 17:30 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

---
 autotests/testAP/scan_test.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 autotests/testAP/scan_test.py

diff --git a/autotests/testAP/scan_test.py b/autotests/testAP/scan_test.py
new file mode 100644
index 00000000..0935912c
--- /dev/null
+++ b/autotests/testAP/scan_test.py
@@ -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')
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher
  2022-11-03 17:30 [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher James Prestwood
                   ` (2 preceding siblings ...)
  2022-11-03 17:30 ` [PATCH 4/4] auto-t: add test for scanning " James Prestwood
@ 2022-11-03 18:17 ` Marcel Holtmann
  2022-11-03 19:01   ` James Prestwood
  3 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2022-11-03 18:17 UTC (permalink / raw)
  To: James Prestwood; +Cc: iwd

Hi James,

> ---
> doc/access-point-api.txt | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
> 
> diff --git a/doc/access-point-api.txt b/doc/access-point-api.txt
> index 63e61d49..28e6437d 100644
> --- a/doc/access-point-api.txt
> +++ b/doc/access-point-api.txt
> @@ -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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher
  2022-11-03 18:17 ` [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher Marcel Holtmann
@ 2022-11-03 19:01   ` James Prestwood
  2022-11-03 19:28     ` Denis Kenzior
  0 siblings, 1 reply; 8+ messages in thread
From: James Prestwood @ 2022-11-03 19:01 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: iwd

On Thu, 2022-11-03 at 19:17 +0100, Marcel Holtmann wrote:
> Hi James,
> 
> > ---
> > doc/access-point-api.txt | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> > 
> > diff --git a/doc/access-point-api.txt b/doc/access-point-api.txt
> > index 63e61d49..28e6437d 100644
> > --- a/doc/access-point-api.txt
> > +++ b/doc/access-point-api.txt
> > @@ -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.

We could do this yes. The implemenation has already been merged but we
could change this to an array easy enough.

> 
> Regards
> 
> Marcel
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher
  2022-11-03 19:01   ` James Prestwood
@ 2022-11-03 19:28     ` Denis Kenzior
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2022-11-03 19:28 UTC (permalink / raw)
  To: James Prestwood, Marcel Holtmann; +Cc: iwd

Hi James,

>> why not array{string} since that makes it a cleaner from an API point
>> of view.

Yeah, I concur this would be better.

> 
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/4] auto-t: add test for scanning in AP mode
  2022-11-03 17:00 James Prestwood
@ 2022-11-03 17:00 ` James Prestwood
  0 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-11-03 17:00 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

---
 autotests/testAP/scan_test.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 autotests/testAP/scan_test.py

diff --git a/autotests/testAP/scan_test.py b/autotests/testAP/scan_test.py
new file mode 100644
index 00000000..0935912c
--- /dev/null
+++ b/autotests/testAP/scan_test.py
@@ -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')
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-03 19:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 17:30 [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher James Prestwood
2022-11-03 17:30 ` [PATCH 2/4] ap: update Scanning property when AP starts James Prestwood
2022-11-03 17:30 ` [PATCH 3/4] auto-t: iwd.py: allow certain APIs to be used in AP mode James Prestwood
2022-11-03 17:30 ` [PATCH 4/4] auto-t: add test for scanning " James Prestwood
2022-11-03 18:17 ` [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher Marcel Holtmann
2022-11-03 19:01   ` James Prestwood
2022-11-03 19:28     ` Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2022-11-03 17:00 James Prestwood
2022-11-03 17:00 ` [PATCH 4/4] auto-t: add test for scanning in AP mode James Prestwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.