All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/11] ap: Move sending CMD_START_AP to common function
@ 2021-05-10  8:57 Andrew Zaborowski
  2021-05-10  8:57 ` [PATCH 02/11] ap: Refactor DHCP settings loading Andrew Zaborowski
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Andrew Zaborowski @ 2021-05-10  8:57 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2500 bytes --]

---
 src/ap.c | 59 +++++++++++++++++++++++++++-----------------------------
 1 file changed, 28 insertions(+), 31 deletions(-)

diff --git a/src/ap.c b/src/ap.c
index a0420ed1..8851cb85 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -2260,34 +2260,41 @@ static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
 	return cmd;
 }
 
-static void ap_ifaddr4_added_cb(int error, uint16_t type, const void *data,
-				uint32_t len, void *user_data)
+static bool ap_start_send(struct ap_state *ap)
 {
-	struct ap_state *ap = user_data;
-	struct l_genl_msg *cmd;
-
-	ap->rtnl_add_cmd = 0;
+	struct l_genl_msg *cmd = ap_build_cmd_start_ap(ap);
 
-	if (error) {
-		l_error("Failed to set IP address");
-		goto error;
+	if (!cmd) {
+		l_error("ap_build_cmd_start_ap failed");
+		return false;
 	}
 
-	cmd = ap_build_cmd_start_ap(ap);
-	if (!cmd)
-		goto error;
-
 	ap->start_stop_cmd_id = l_genl_family_send(ap->nl80211, cmd,
 							ap_start_cb, ap, NULL);
 	if (!ap->start_stop_cmd_id) {
+		l_error("AP_START l_genl_family_send failed");
 		l_genl_msg_unref(cmd);
-		goto error;
+		return false;
 	}
 
-	return;
+	return true;
+}
 
-error:
-	ap_start_failed(ap);
+static void ap_ifaddr4_added_cb(int error, uint16_t type, const void *data,
+				uint32_t len, void *user_data)
+{
+	struct ap_state *ap = user_data;
+
+	ap->rtnl_add_cmd = 0;
+
+	if (error) {
+		l_error("Failed to set IP address");
+		ap_start_failed(ap);
+		return;
+	}
+
+	if (!ap_start_send(ap))
+		ap_start_failed(ap);
 }
 
 static bool ap_parse_new_station_ies(const void *data, uint16_t len,
@@ -2858,7 +2865,6 @@ struct ap_state *ap_start(struct netdev *netdev, struct l_settings *config,
 {
 	struct ap_state *ap;
 	struct wiphy *wiphy = netdev_get_wiphy(netdev);
-	struct l_genl_msg *cmd;
 	uint64_t wdev_id = netdev_get_wdev_id(netdev);
 	int err = -EINVAL;
 	bool wait_on_address = false;
@@ -2949,22 +2955,13 @@ struct ap_state *ap_start(struct netdev *netdev, struct l_settings *config,
 		return ap;
 	}
 
-	cmd = ap_build_cmd_start_ap(ap);
-	if (!cmd)
-		goto error;
+	if (ap_start_send(ap)) {
+		if (err_out)
+			*err_out = 0;
 
-	ap->start_stop_cmd_id = l_genl_family_send(ap->nl80211, cmd,
-							ap_start_cb, ap, NULL);
-	if (!ap->start_stop_cmd_id) {
-		l_genl_msg_unref(cmd);
-		goto error;
+		return ap;
 	}
 
-	if (err_out)
-		*err_out = 0;
-
-	return ap;
-
 error:
 	if (err_out)
 		*err_out = err;
-- 
2.27.0

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

end of thread, other threads:[~2021-05-11 22:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10  8:57 [PATCH 01/11] ap: Move sending CMD_START_AP to common function Andrew Zaborowski
2021-05-10  8:57 ` [PATCH 02/11] ap: Refactor DHCP settings loading Andrew Zaborowski
2021-05-11 14:56   ` Denis Kenzior
2021-05-10  8:57 ` [PATCH 03/11] ap: Refactor global address pool loading Andrew Zaborowski
2021-05-10  8:57 ` [PATCH 04/11] ap: Add subnet address selection logic Andrew Zaborowski
2021-05-11 15:06   ` Denis Kenzior
2021-05-11 21:04     ` Andrew Zaborowski
2021-05-11 22:20       ` Denis Kenzior
2021-05-10  8:58 ` [PATCH 05/11] ap: Dump addreses in use and assign local IP Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 06/11] ap: Move the DHCP server freeing to ap_reset Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 07/11] ap: Send a specific error message on async AP start failure Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 08/11] autotests: Update APRanges usage in testAP Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 09/11] doc: Update AP settings in iwd.ap(5) and iwd.config(5) Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 10/11] main: Add NetworkConfigurationEnabled to Daemon.GetInfo() Andrew Zaborowski
2021-05-11 15:09   ` Denis Kenzior
2021-05-10  8:58 ` [PATCH 11/11] doc: Document NetworkConfigurationEnabled in Daemon.GetInfo() Andrew Zaborowski
2021-05-11 14:48 ` [PATCH 01/11] ap: Move sending CMD_START_AP to common function Denis Kenzior

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.