diff mbox series

eap: fix the duplicated registration of eap server

Message ID AM9PR04MB8779F78D6F29DB3395EA064881BE2@AM9PR04MB8779.eurprd04.prod.outlook.com
State Changes Requested
Headers show
Series eap: fix the duplicated registration of eap server | expand

Commit Message

Maochen Wang Aug. 5, 2024, 3:16 a.m. UTC
From ca0b2812a3f2ce1952a805212a02e99f70da786f Mon Sep 17 00:00:00 2001
From: Maochen Wang mailto:maochen.wang@nxp.com
Date: Tue, 30 Jul 2024 17:30:40 +0800
Subject: [PATCH] eap: fix the duplicated registration of eap server
method

Fix the duplicated registration of eap server method, as on Zephyr OS,
hostapd and supplicant are running in same task, when hostapd enabled,
eap_server_register_methods() will also call the eap server related
functions, which leads to the duplicated registration of eap server
method.

Signed-off-by: Maochen Wang mailto:maochen.wang@nxp.com
---
wpa_supplicant/eap_register.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jouni Malinen Aug. 10, 2024, 7:37 a.m. UTC | #1
On Mon, Aug 05, 2024 at 03:16:08AM +0000, Maochen Wang wrote:
> Fix the duplicated registration of eap server method, as on Zephyr OS,
> hostapd and supplicant are running in same task, when hostapd enabled,
> eap_server_register_methods() will also call the eap server related
> functions, which leads to the duplicated registration of eap server
> method.

So this is somehow building both hostapd/*.c and wpa_supplicant/*.c code
into a single binary? I'd expect that to fail due to conflicting
symbols, so this needs some other changes as well and those do not exist
in hostap.git..

> diff --git a/wpa_supplicant/eap_register.c b/wpa_supplicant/eap_register.c
> +#ifndef HOSTAPD
> #ifdef EAP_SERVER_IDENTITY

That feels strange from hostap.git view point. There is nothing there
that would result in HOSTAPD being defined when compiling
wpa_supplicant/*.c.

If this is needed for some custom builds that have modified the way the
process is initiated using changes that do not exist in hostap.git, it
would seem cleaner to keep this change in those out-of-hostap.git
changes as well.
diff mbox series

Patch

diff --git a/wpa_supplicant/eap_register.c b/wpa_supplicant/eap_register.c
index 3f018c4b3..d009be5dd 100644
--- a/wpa_supplicant/eap_register.c
+++ b/wpa_supplicant/eap_register.c
@@ -152,6 +152,7 @@  int eap_register_methods(void)
            ret = eap_peer_eke_register();
#endif /* EAP_EKE */

+#ifndef HOSTAPD
#ifdef EAP_SERVER_IDENTITY
     if (ret == 0)
            ret = eap_server_identity_register();
@@ -266,6 +267,6 @@  int eap_register_methods(void)
     if (ret == 0)
            ret = eap_server_pwd_register();
#endif /* EAP_SERVER_PWD */
-
+#endif /* HOSTAPD *
     return ret;
}