Skip to contentSkip to conversation

netdev: destroy auth-proto in connect event, for ext auth

RFC In review James Prestwood 2 participants 2 messages Dec 19, 2024

lore
Share & tools
lore
#0 lore raw

RFC 1/1 netdev: destroy auth-proto in connect event, for ext auth

With external auth there is no associate event meaning the auth proto never gets freed, which prevents eapol from starting inside the OCI callback. Check for this specific case and free the auth proto in the connect event.

---
 src/netdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
src/netdev.c +12 -0
index 02496c92..9deff699 100644
@@ -2615,6 +2615,8 @@ static void netdev_connect_event(struct l_genl_msg *msg, struct netdev *netdev)
 	struct handshake_state *hs = netdev->handshake;
 	bool timeout = false;
 	uint32_t timeout_reason = 0;
+	struct netdev_handshake_state *nhs = l_container_of(netdev->handshake,
+				struct netdev_handshake_state, super);
 
 	l_debug("");
 
@@ -2821,6 +2823,16 @@ process_resp_ies:
 
 	l_debug("Request / Response IEs parsed");
 
+	/*
+	 * This should only be the case for Fullmac/External auth. Here we don't
+	 * get an associate event, so we need to destroy the auth-proto now
+	 * so eapol gets started within the OCI callback
+	 */
+	if (netdev->ap && nhs->type == CONNECTION_TYPE_FULLMAC) {
+		auth_proto_free(netdev->ap);
+		netdev->ap = NULL;
+	}
+
 	if (netdev->sm) {
 		if (!hs->chandef) {
 			if (netdev_get_oci(netdev) < 0)
Signature · 1 line
2.34.1
#1 lore raw

Hi James,

Quoted 8 lines · James Prestwood

With external auth there is no associate event meaning the auth proto never gets freed, which prevents eapol from starting inside the OCI callback. Check for this specific case and free the auth proto in the connect event.

---
  src/netdev.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)

<snip>

Quoted 4 lines
src/netdev.c +0 -0
@@ -2821,6 +2823,16 @@ process_resp_ies:
 
  	l_debug("Request / Response IEs parsed");
 

src/netdev.c process_resp_ies: · line 2835

Quoted 10 lines
src/netdev.c +10 -0
+	/*
+	 * This should only be the case for Fullmac/External auth. Here we don't
+	 * get an associate event, so we need to destroy the auth-proto now
+	 * so eapol gets started within the OCI callback
+	 */
+	if (netdev->ap && nhs->type == CONNECTION_TYPE_FULLMAC) {
+		auth_proto_free(netdev->ap);
+		netdev->ap = NULL;
+	}
+

Would this be better done in netdev_external_auth_sae_tx_associate() instead?

src/netdev.c process_resp_ies: · line 2838

Quoted 3 lines
src/netdev.c +0 -0
  	if (netdev->sm) {
  		if (!hs->chandef) {
  			if (netdev_get_oci(netdev) < 0)

Regards,
-Denis