From patchwork Fri Nov 4 16:37:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13032336 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8FB979F1 for ; Fri, 4 Nov 2022 16:38:06 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id c2so5363977plz.11 for ; Fri, 04 Nov 2022 09:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hMBkXGxqxAEP5TxsN1MnS0D2OblAGH7zCOQvv0ird10=; b=GGMly5GTsHbrCNO9Pqgt0U1boDAeNj70XjIhR+8iGISrEgcPYbsMFXVyVnsQvjW3Lp h76RuTNw4aBrd0/I9XIOtQ2uu1ajaJd0rc0V72i4hXdIvnG0b/x+KBEo2Dy2ylpZJ676 jOZEzjuFvdSa+BTETaRR9a1Kw4cHonlDtsLS5b7QSl9rbhjK7KIpLYpwLFs30tFrCKbe ff/GTc0V4obMrNHBKGU54MEwF9bqKCGqSu6CNECLhl5dawV5LpBhfc0A6HM046adzSlL P5c7qMDlvDuTEGdmToY4BycDxoTmtscHqSThMtF/JgF6gP1WpNBAjTdAMMKTgf5VbvGp pCxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hMBkXGxqxAEP5TxsN1MnS0D2OblAGH7zCOQvv0ird10=; b=QIrbIfLc998ewC5edN4hRshk++zjBZ03+PHbm6IUC7EJ54x17vZKuF7uI07a7V1S8O rBUA7mVedjxOG2iM7R9pP6uiaK74l68ezITgkNunz3XKgFdCpDgzFodAUs9W01B5sXVF BeUAQfqyi6nWpAIivgDHO4TaUZz0NBhJK9lQTTJD3ajqR/wCqOps5TFo4BX2wFIqTAKT /2RbwAvnFclIg7eGkuQPiyH455icaMqbGCV9ZIm9LBRg1wSsGIympaIo5VupAX6SNqEK WjP9QzQYWo2na+DCM6be1o3tmvSJJbWPhsB3sdOWivQ7U81FXBgQRc9j7h3SIBcAdolS QGFg== X-Gm-Message-State: ACrzQf3hEHTfFVGfRo1NQS/0OiRdblozMOFQ1lUkijOx1x2yYZ/4vFPQ ycGdrqEKQVLsE+gnTLieWXnmMjzjEFM= X-Google-Smtp-Source: AMsMyM6dy0LM4m1Fa/jQWIsomVstDzgHw/lQRcd2ksCO8yPg/NE05D+Y1rF83LAer9hsEVzbFUKghA== X-Received: by 2002:a17:902:f78c:b0:185:3d6a:7576 with SMTP id q12-20020a170902f78c00b001853d6a7576mr36230580pln.86.1667579885868; Fri, 04 Nov 2022 09:38:05 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.160.234]) by smtp.gmail.com with ESMTPSA id 65-20020a620544000000b0056e15b7138esm2904741pff.157.2022.11.04.09.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 09:38:05 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 1/6] ap: update Scanning property when AP starts Date: Fri, 4 Nov 2022 09:37:55 -0700 Message-Id: <20221104163800.451867-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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(-) 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), From patchwork Fri Nov 4 16:37:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13032337 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2B928471 for ; Fri, 4 Nov 2022 16:38:07 +0000 (UTC) Received: by mail-pf1-f177.google.com with SMTP id b29so4947012pfp.13 for ; Fri, 04 Nov 2022 09:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uuaLdpWzsIa65B9D+BQqDuU1vAJrEspEFUSJXgonnZ0=; b=UscH8k4Cqccn3y9Bvehog0SRlvJmIScb/yh8UcvwpuR1ncRa6V8/giixcHHISAoOyY ak1pEqShxBxYIy3aB0Xfv5wpGesOi7LmkA2MO4nho/orVuelVucOa52mOmK9pLCCYx6r 6pMPlGK1PJWjuaFV407A1gT7dQ0ToyzN7ksvhpp3L4/QGJGyNxH2pfs9Jms0sc69FI4U peB9iJKshgo3RP0tmV9kJc1c4klBBb7IyBKl7nUMzEndgQ2bpGl5s6TUM+KRjPsJmkJN vw/3se7cfjK3gC//HhSPYSG1jBPVQ6VIj/TuCpAxGFSdrjI8UYM9GwCut5UUJ2CgSwq0 Tjcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uuaLdpWzsIa65B9D+BQqDuU1vAJrEspEFUSJXgonnZ0=; b=4ErM1D4/SkaobWQc0DtjeN8dkeLqX1aFyeA20Dx8KI2gPAaXDtAuIhkGtYxBCRn0d5 RY9yhJR5cW2JtW2o+1EDNi9piCGWfWrvAnWyeRXScWVTdpBJG0IELMogYMlMGU2j0e3q avehaMQywkinJ6yzIX7cXB4G5Enx+hpmuJVcjFjS2UHrVqivX+HcqW7hEtqP4W4v23VE nCbLqzHApAiRQwHcfZce9b9Gm5PgL+YzcSK3JMzTRGVvIwqSoZLJg1mT7lltL0Kh+54w k38kPPlar9pdubkmFwLEJFYZBLwitKR55LQCSWzS5Af1Hqls25c2pxXCqOUDcMaTvjAz LfoA== X-Gm-Message-State: ACrzQf0lwumuuazlM57k2jpZY3ywteKU0dskBeCOyr3hzFhc7qvdPmCr igg+mThGPBboQvCBKRFjbAbyh/jPEo0= X-Google-Smtp-Source: AMsMyM4Qy/AFIZKdYf7Ntn10ZYwOeYU7Y+Ih4qELw9DmO30ogAi0OAh3bIbB7H3oTD10qAHL8PaXnQ== X-Received: by 2002:a63:6b49:0:b0:46a:fcba:308f with SMTP id g70-20020a636b49000000b0046afcba308fmr31475808pgc.8.1667579887064; Fri, 04 Nov 2022 09:38:07 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.160.234]) by smtp.gmail.com with ESMTPSA id 65-20020a620544000000b0056e15b7138esm2904741pff.157.2022.11.04.09.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 09:38:06 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 2/6] auto-t: iwd.py: allow certain APIs to be used in AP mode Date: Fri, 4 Nov 2022 09:37:56 -0700 Message-Id: <20221104163800.451867-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20221104163800.451867-1-prestwoj@gmail.com> References: <20221104163800.451867-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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(): From patchwork Fri Nov 4 16:37:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13032338 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB49A79F1 for ; Fri, 4 Nov 2022 16:38:08 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so8725250pji.1 for ; Fri, 04 Nov 2022 09:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jdB7I+XkRlGpC7TkkPgj49Yc/D3ExGTSZAYf7qlfNsE=; b=H69ro+fFA4QJ+o/urWmxKUQiWkNgOGhH79fKrstiZ0kDSwqqeYUAj5wauhGkNZUNZi i1jrmg2BnPNhjHMzQ+2fgoflgB72kHyv5IBtEuhshZi49PerVTzWz1nyXbWSu9cx7htA xrLIpCmlaiVBzA/khRCXyjH0AVNrUsrDfn90HMUg7kWuhGjPBTbTWpC9MEIQ5+GDYdP5 P4xWFLxciLnYTJ47OkiSAwavD5qViOLkwfWskBrMS36qebLF0GBBnwJZcNbvZXa/U4/0 oSux7CKsPB0rPTDCtoGatK0D4qmP3wtS8KHggdB9Md1pumTlPhObD7sU+wqvtSCeFMJO p6xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jdB7I+XkRlGpC7TkkPgj49Yc/D3ExGTSZAYf7qlfNsE=; b=m0NA68c0z4JNb8fMlTdanR7JEknIQhmXrKfue04adl9as/W2sijz2miEWmpysdiKJr 9fjXog0TU1CNlKiLikz3a91Lw0fgQt87Lelv5p/I+AukipQMxgG0XFXPqD+1eg22UCfo h7R/YQrj61bF2GUbUUThR9HDXTKgGSn5ZEiAG3TqjA9tZ7b/OoOL1txoKrifYwce0oaS 3QNApKb9BtyB0GDlXGU7EQEm+hNxt/GsOl3DsXmuvxhV2caMPnnirUvcDdQfgXAfVbrH CtcJB/TJ5D1SPCWgTWY+cVTjAHNGo/jlx+6bX8+goWqN1BAT67LYYCp1iC/nwgh239gu K2nQ== X-Gm-Message-State: ACrzQf2D9W98VkNChbKulYJB81StyQNBo/Uz/jJZIWgjzBGGhcDiMCtk NcB6PVxJh57z+Atgv86PLGa8/Vc6p4Y= X-Google-Smtp-Source: AMsMyM5QT3CSZ4QgwT70p1TPui1zuiylGbstM6S1jubQNvt//BKu/picTzwXxFlZvSDn78XmgMge1w== X-Received: by 2002:a17:902:7446:b0:186:a3a1:782d with SMTP id e6-20020a170902744600b00186a3a1782dmr36424272plt.76.1667579888152; Fri, 04 Nov 2022 09:38:08 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.160.234]) by smtp.gmail.com with ESMTPSA id 65-20020a620544000000b0056e15b7138esm2904741pff.157.2022.11.04.09.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 09:38:07 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 3/6] auto-t: add test for scanning in AP mode Date: Fri, 4 Nov 2022 09:37:57 -0700 Message-Id: <20221104163800.451867-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20221104163800.451867-1-prestwoj@gmail.com> References: <20221104163800.451867-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- 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') From patchwork Fri Nov 4 16:37:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13032339 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBC228471 for ; Fri, 4 Nov 2022 16:38:09 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id m6-20020a17090a5a4600b00212f8dffec9so5032530pji.0 for ; Fri, 04 Nov 2022 09:38:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7nNtHXCV96L5t2y4Vr2ClYVoWJyGO4k/Fwg1Qzb3hFI=; b=mNs1o1QSgQn1qfbQgJwp0pjxBQYhv6UAHBEPcDF5r7RoxUevlMjLsJPqKhY7DRJglv V1EqOR44zcop7I9hlrR1vFDA9dQb7Hwf344ndovCa0id1lBuN2xXxCqfFWs5Uk/iQ5/9 p602t/HhIGXtnyc/kVU4F+eoEaJg3VD+5QH5X0pSlkabxUQ8aCZRm7j/IsbfM4zU3grz WQUKvctHMWVMz8AE11PYpe+TgcZkkYbnJNv9RlEnhSMAL/iVtYxX0xit08gGWzn59FZT j6p/mwvy59jEKlZ4xY0ELMYedjTIW5BWHDLhVowF2HXtkqRFkj/2yeeNrj+fj1Z/BeCG 9FDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7nNtHXCV96L5t2y4Vr2ClYVoWJyGO4k/Fwg1Qzb3hFI=; b=lxPU0l8webzCEPtAMOWDyIdOqTzWZM3Vq9qYkUm7D5CQJ7GkUoLY4xiB1OT9vVGq2Q i31FYqFSl34GqKThaUgiTnX2V92mvAviJ0ioa07N7Nfr+jx8wLRuq4CCD9v03EteW2eb jbSp8dUNhL5lJ3ZhrxF2ggL+u6u1Ik9nJT9EQyr2QmCMQbFltBdgtWVtOzxWrWMMcX+w HXAJ8ZWoZ1c7Lyfy6fFQ5Qq8sZoijsAC28Bit/lE2kg7CMg7EYKqn68exEY8hu1vVGl7 gif1tiKTf8NBgu4l/xKf6Ffc9lNawJzYO436M8e24yP8ED9EfLEq1QHyIR6VZsP2UZHV 2w1A== X-Gm-Message-State: ACrzQf0n511H2uLyKPuW0eB1Ckk7siQWQuACdJfHmC0ReZr21qOpvDuK 3iIPopH0ro2eRaXFvKgYWQGMS2HD5hg= X-Google-Smtp-Source: AMsMyM6YpGR6xo8MEHc8ERNe+Bj86HC4hA3hy0nhDNd5zKsNITU/Jk7RdKXIRALKIqOJPmFuXuki/A== X-Received: by 2002:a17:902:ec8e:b0:186:f4ba:a7fc with SMTP id x14-20020a170902ec8e00b00186f4baa7fcmr36249249plg.55.1667579889161; Fri, 04 Nov 2022 09:38:09 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.160.234]) by smtp.gmail.com with ESMTPSA id 65-20020a620544000000b0056e15b7138esm2904741pff.157.2022.11.04.09.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 09:38:08 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 4/6] ap: change PairwiseCiphers to string array Date: Fri, 4 Nov 2022 09:37:58 -0700 Message-Id: <20221104163800.451867-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20221104163800.451867-1-prestwoj@gmail.com> References: <20221104163800.451867-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A comma separated list as a string was ok for pure display purposes but if any processing needed to be done on these values by external consumers it really makes more sense to use a DBus array. --- src/ap.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/ap.c b/src/ap.c index 665c1857..69412174 100644 --- a/src/ap.c +++ b/src/ap.c @@ -3154,11 +3154,10 @@ static enum ie_rsn_cipher_suite ap_string_to_cipher(const char *str) return 0; } -static char *ap_ciphers_to_string(uint16_t ciphers) +static char **ap_ciphers_to_strv(uint16_t ciphers) { uint16_t i; char **list = l_strv_new(); - char *ret; for (i = 0; i < 16; i++) { if (!(ciphers & (1 << i))) @@ -3168,9 +3167,7 @@ static char *ap_ciphers_to_string(uint16_t ciphers) ie_rsn_cipher_suite_to_string(1 << i)); } - ret = l_strjoinv(list, ','); - l_strv_free(list); - return ret; + return list; } static int ap_load_config(struct ap_state *ap, const struct l_settings *config, @@ -4096,15 +4093,22 @@ static bool ap_dbus_property_get_pairwise(struct l_dbus *dbus, void *user_data) { struct ap_if_data *ap_if = user_data; - char *list; + char **ciphers; + size_t i; if (!ap_if->ap || !ap_if->ap->started) return false; - list = ap_ciphers_to_string(ap_if->ap->ciphers); + ciphers = ap_ciphers_to_strv(ap_if->ap->ciphers); + + l_dbus_message_builder_enter_array(builder, "s"); + + for (i = 0; ciphers[i]; i++) + l_dbus_message_builder_append_basic(builder, 's', ciphers[i]); + + l_dbus_message_builder_leave_array(builder); - l_dbus_message_builder_append_basic(builder, 's', list); - l_free(list); + l_strv_free(ciphers); return true; } @@ -4115,15 +4119,16 @@ static bool ap_dbus_property_get_group(struct l_dbus *dbus, void *user_data) { struct ap_if_data *ap_if = user_data; - char *cipher; + char **cipher; if (!ap_if->ap || !ap_if->ap->started) return false; - cipher = ap_ciphers_to_string(ap_if->ap->group_cipher); + cipher = ap_ciphers_to_strv(ap_if->ap->group_cipher); - l_dbus_message_builder_append_basic(builder, 's', cipher); - l_free(cipher); + /* Group cipher will only ever be a single value */ + l_dbus_message_builder_append_basic(builder, 's', cipher[0]); + l_strv_free(cipher); return true; } @@ -4149,7 +4154,7 @@ static void ap_setup_interface(struct l_dbus_interface *interface) ap_dbus_property_get_scanning, NULL); l_dbus_interface_property(interface, "Frequency", 0, "u", ap_dbus_property_get_freq, NULL); - l_dbus_interface_property(interface, "PairwiseCiphers", 0, "s", + l_dbus_interface_property(interface, "PairwiseCiphers", 0, "as", ap_dbus_property_get_pairwise, NULL); l_dbus_interface_property(interface, "GroupCipher", 0, "s", ap_dbus_property_get_group, NULL); From patchwork Fri Nov 4 16:37:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13032340 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1EE179F1 for ; Fri, 4 Nov 2022 16:38:10 +0000 (UTC) Received: by mail-pf1-f182.google.com with SMTP id z26so4993682pff.1 for ; Fri, 04 Nov 2022 09:38:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=paCJRibZ3ohngBpfrclV9n9vOU5JZSflIIqqHAN/jGs=; b=Pn7TuA9FV6Zp6risr87TZUJtgHvP3lly1eFtq8LMqbIEaDRpJRYTx6jkV+NxYXvRKQ Aka8rM2JJbDnweysRZ1iQJVwLL8y216OEEMtTawgpvAbS1gErv0DpmRjJ4/GGh4svKG9 XsCpxtQ6rzGEjuQLfZjNF6zo3EeyjFYP9cq4AFoSOPStHaetJpBXt27v2Qhu6oHa7Rvg 254jWWOK+ExdrMP9yklufXnRymPLOS1h78aVfEmxgoIsqohPq+HWv5StyfQIG5qmUUja eKmBu3a0zNxtyS1YKIuJG2fiNSPkDXkDziX8cvn7cUV33EaQsvIvHylc+kH1WOASvuWU vEng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=paCJRibZ3ohngBpfrclV9n9vOU5JZSflIIqqHAN/jGs=; b=MFN2uFR1Me7VZc5Yu6/gQJ6b3FaE/xl980mz5as2Uzy4OSThl44/OTzAPCBKvyG/ro 4QMM9+zD90i6vjz5Kaa2KeEDMx/uWt8GX8QnaH6gLCW+aQmOCzvkH1gC6hvoKIYbu72L XCwqfLl9pPQ2a2tjCSLMvXMQON0K7g8Ux9RPe/tkNknR2l6Wr90L7GLlTHuSm5pJxJVw mRA0EP8K/ZM7WsOc7u/DQp87VcN1kuMi+wxsu+Y9r7k4+ECtJM9pg9MLr+42hmkiSjLl JQ9XRuQ65R8JhqLlcaT2S+k0OnD7xr/XIXmwHw1opA1CefwiGyBD2jokVco4Xtuk/wD4 8hFg== X-Gm-Message-State: ACrzQf1tVgG41w7cuBvQjSYAaoGAfYU4p50Ds9isjC6EI2BdBJ7FooHO NeP7hXz/B8xQ8YzZNuMqk1TrcrL++Ng= X-Google-Smtp-Source: AMsMyM5CknRwnN2TSHqou7BRBZfUAOdzZ48LMm+lsYskFS0UrwP+WQYrm32laICu+37AM8NOXoQBng== X-Received: by 2002:a62:4c2:0:b0:52e:bd4d:50e1 with SMTP id 185-20020a6204c2000000b0052ebd4d50e1mr37102956pfe.8.1667579890170; Fri, 04 Nov 2022 09:38:10 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.160.234]) by smtp.gmail.com with ESMTPSA id 65-20020a620544000000b0056e15b7138esm2904741pff.157.2022.11.04.09.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 09:38:09 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 5/6] auto-t: update test to work with PairwiseCiphers array Date: Fri, 4 Nov 2022 09:37:59 -0700 Message-Id: <20221104163800.451867-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20221104163800.451867-1-prestwoj@gmail.com> References: <20221104163800.451867-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- autotests/testAP-no-support/connection_test.py | 2 +- autotests/testAP/connection_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autotests/testAP-no-support/connection_test.py b/autotests/testAP-no-support/connection_test.py index d7a13f51..47c06262 100644 --- a/autotests/testAP-no-support/connection_test.py +++ b/autotests/testAP-no-support/connection_test.py @@ -27,7 +27,7 @@ class Test(unittest.TestCase): dev_ap.start_ap('TestAP2', 'Password2') self.assertTrue(dev_ap.group_cipher == 'TKIP') - self.assertTrue(dev_ap.pairwise_ciphers == 'TKIP') + self.assertIn('TKIP', dev_ap.pairwise_ciphers) ordered_network = dev_sta.get_ordered_network('TestAP2') diff --git a/autotests/testAP/connection_test.py b/autotests/testAP/connection_test.py index 53dcfaba..a9135c26 100644 --- a/autotests/testAP/connection_test.py +++ b/autotests/testAP/connection_test.py @@ -60,7 +60,7 @@ class Test(unittest.TestCase): dev1.start_ap('TestAP2') self.assertTrue(dev1.group_cipher == group) - self.assertTrue(dev1.pairwise_ciphers == pairwise) + self.assertIn(pairwise, dev1.pairwise_ciphers) try: validate(wd, dev2, dev1, 'TestAP2', 'Password2', ip_checks=False) From patchwork Fri Nov 4 16:38:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13032341 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8B968471 for ; Fri, 4 Nov 2022 16:38:11 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id m14-20020a17090a3f8e00b00212dab39bcdso8758659pjc.0 for ; Fri, 04 Nov 2022 09:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yYK496Z2pWP9IG3NNodMvaDGW/2norS2aZTnMpVS6Z8=; b=lC9JNbMk7ctlCnt6JP4QVg57i8a39iBRlbm7lViYjIfDkr4u4DjZAvNR06J6DTzehZ vJ9cIBwUToy5PtoBf/9U9jTvQOA8iOBMYMGLk73GgV4wSOPAMDR+6djRv1QD1yLr0aEO gHU4bRQPq9anX49CfQSb7tW4IbUR+qF9AESzaI4pNt9woR/bfjCgvIVvxS6/sJQxR4cd j00yRVZiVFeGiVYZiOr6Pby1/6Isl+ZQ+EgpsmCccofXp+Vj7/l0mvabAOwqeZANGZON 4xFb1eBBGipRBc/QG1n2KPkaLWhfAGE0jLlxuesh7OJ3Cvo6TTL5KYqPxsRyMJi3rJ6K gVHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yYK496Z2pWP9IG3NNodMvaDGW/2norS2aZTnMpVS6Z8=; b=yn1Vp9JH4RiPZRkzImzJ+Q1nE2ZZXiY0o/u07FAD2z+KSbWEwqDbBKkTJjti8ub68Y phyZseMX7nshIXckfQuUD5KTYUDqXc1zEWIDKCQVrgpMeFDF+tTN+jcybZ5z8hJILQH7 SqWBJQsc4u1PuSFGrEAxURIZKQxch6f4pKbz6XqdsIZyKNnN0uOTnmmMqnxPbK5FD7KM VozYltXuC/bosZAcN5fkHeROaSzM+59hzbce78YTQT8ns2UxhqmO1BWBGyYvdtHsC0iu 5HkZL7G0zDHf/p1tGFgZJcggOXxuYO8r8YeeTE7EYmd1EYRfcjZTf7NX1WwzEvRLbF/d Qnjg== X-Gm-Message-State: ACrzQf011ic+YAjLOiCaY9Q1PG/868A2hclfJ8cL0rOZVLQNyZ/lifEn pPI173pcdekMy1BurGZpcIrXdW3RIrA= X-Google-Smtp-Source: AMsMyM6AKPpxFcRNDgjhzUPhH1qW+L7OsGD41E5mQ22DTzKQM0MfFa6Qc/uTSBtrKe0qUcsCeAlclA== X-Received: by 2002:a17:902:c943:b0:187:1572:282b with SMTP id i3-20020a170902c94300b001871572282bmr31510836pla.126.1667579891162; Fri, 04 Nov 2022 09:38:11 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.160.234]) by smtp.gmail.com with ESMTPSA id 65-20020a620544000000b0056e15b7138esm2904741pff.157.2022.11.04.09.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 09:38:10 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 6/6] doc: document AP properties PairwiseCiphers/GroupCipher Date: Fri, 4 Nov 2022 09:38:00 -0700 Message-Id: <20221104163800.451867-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20221104163800.451867-1-prestwoj@gmail.com> References: <20221104163800.451867-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- doc/access-point-api.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/access-point-api.txt b/doc/access-point-api.txt index 63e61d49..839feb26 100644 --- a/doc/access-point-api.txt +++ b/doc/access-point-api.txt @@ -71,3 +71,15 @@ Properties boolean Started [readonly] uint32 Frequency [readonly, optional] The frequency that the Access Point is operating on. + + array{string} PairwiseCiphers [readonly, optional] + + 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 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.