diff mbox series

[2/4] ap: update Scanning property when AP starts

Message ID 20221103170050.379587-2-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series [1/4] doc: document AP properties PairwiseCiphers/GroupCipher | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-ci-incremental_build fail Make FAIL (patch 1): src/ap.c:3669:42: error: ‘struct ap_if_data’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror] 3669 | static void ap_properties_changed(struct ap_if_data *ap_if) | ^~~~~~~~~~ src/ap.c: In function ‘ap_properties_changed’: src/ap.c:3672:54: error: invalid use of undefined type ‘struct ap_if_data’ 3672 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3675:54: error: invalid use of undefined type ‘struct ap_if_data’ 3675 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3678:54: error: invalid use of undefined type ‘struct ap_if_data’ 3678 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3681:54: error: invalid use of undefined type ‘struct ap_if_data’ 3681 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3684:54: error: invalid use of undefined type ‘struct ap_if_data’ 3684 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3687:54: error: invalid use of undefined type ‘struct ap_if_data’ 3687 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c: In function ‘ap_if_event_func’: src/ap.c:3729:39: error: passing argument 1 of ‘ap_properties_changed’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3729 | ap_properties_changed(ap_if); | ^~~~~ | | | struct ap_if_data * src/ap.c:3669:54: note: expected ‘struct ap_if_data *’ but argument is of type ‘struct ap_if_data *’ 3669 | static void ap_properties_changed(struct ap_if_data *ap_if) | ~~~~~~~~~~~~~~~~~~~^~~~~ src/ap.c:3742:39: error: passing argument 1 of ‘ap_properties_changed’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3742 | ap_properties_changed(ap_if); | ^~~~~ | | | struct ap_if_data * src/ap.c:3669:54: note: expected ‘struct ap_if_data *’ but argument is of type ‘struct ap_if_data *’ 3669 | static void ap_properties_changed(struct ap_if_data *ap_if) | ~~~~~~~~~~~~~~~~~~~^~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:2407: src/ap.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:1586: all] Error 2
prestwoj/iwd-alpine-ci-incremental_build fail Make FAIL (patch 1): src/ap.c:3669:42: error: 'struct ap_if_data' declared inside parameter list will not be visible outside of this definition or declaration [-Werror] 3669 | static void ap_properties_changed(struct ap_if_data *ap_if) | ^~~~~~~~~~ src/ap.c: In function 'ap_properties_changed': src/ap.c:3672:54: error: invalid use of undefined type 'struct ap_if_data' 3672 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3675:54: error: invalid use of undefined type 'struct ap_if_data' 3675 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3678:54: error: invalid use of undefined type 'struct ap_if_data' 3678 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3681:54: error: invalid use of undefined type 'struct ap_if_data' 3681 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3684:54: error: invalid use of undefined type 'struct ap_if_data' 3684 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c:3687:54: error: invalid use of undefined type 'struct ap_if_data' 3687 | netdev_get_path(ap_if->netdev), | ^~ src/ap.c: In function 'ap_if_event_func': src/ap.c:3729:39: error: passing argument 1 of 'ap_properties_changed' from incompatible pointer type [-Werror=incompatible-pointer-types] 3729 | ap_properties_changed(ap_if); | ^~~~~ | | | struct ap_if_data * src/ap.c:3669:54: note: expected 'struct ap_if_data *' but argument is of type 'struct ap_if_data *' 3669 | static void ap_properties_changed(struct ap_if_data *ap_if) | ~~~~~~~~~~~~~~~~~~~^~~~~ src/ap.c:3742:39: error: passing argument 1 of 'ap_properties_changed' from incompatible pointer type [-Werror=incompatible-pointer-types] 3742 | ap_properties_changed(ap_if); | ^~~~~ | | | struct ap_if_data * src/ap.c:3669:54: note: expected 'struct ap_if_data *' but argument is of type 'struct ap_if_data *' 3669 | static void ap_properties_changed(struct ap_if_data *ap_if) | ~~~~~~~~~~~~~~~~~~~^~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:2408: src/ap.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:1587: all] Error 2

Commit Message

James Prestwood Nov. 3, 2022, 5 p.m. UTC
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 mbox series

Patch

diff --git a/src/ap.c b/src/ap.c
index 9c82a545..34a47f17 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -3666,6 +3666,28 @@  bool ap_push_button(struct ap_state *ap)
 	return true;
 }
 
+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");
+}
+
 struct ap_if_data {
 	struct netdev *netdev;
 	struct ap_state *ap;
@@ -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),