[PATCH] Fix compiler warning on CONFIG_AP without CONFIG_P2P builds

Masashi Honma masashi.honma at gmail.com
Sun Oct 31 16:00:56 PDT 2021


../src/ap/ap_drv_ops.c: In function 'hostapd_build_ap_extra_ies':
../src/ap/ap_drv_ops.c:163:10: error: 'struct hostapd_data' has no member named 'p2p_group'
  163 |  if (hapd->p2p_group) {
      |          ^~
../src/ap/ap_drv_ops.c:165:35: error: 'struct hostapd_data' has no member named 'p2p_group'
  165 |   a = p2p_group_assoc_resp_ie(hapd->p2p_group, P2P_SC_SUCCESS);
      |                                   ^~
  CC  ap.c
make: *** [../src/build.rules:86: /home/honma/git/hostap/build/wpa_supplicant/src/ap/ap_drv_ops.o] Error 1

/usr/bin/ld: /home/honma/git/hostap/build/wpa_supplicant/ap.o: in function `wpas_conf_ap_he_6ghz':
/home/honma/git/hostap/wpa_supplicant/ap.c:245: undefined reference to `wpas_p2p_get_sec_channel_offset_40mhz'
collect2: error: ld returned 1 exit status
make: *** [Makefile:1891: wpa_supplicant] Error 1

Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
 wpa_supplicant/Makefile | 3 +--
 wpa_supplicant/ap.c     | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index 737f7af9c..ce1c8b2e3 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -389,12 +389,11 @@ CONFIG_AP=y
 ifdef CONFIG_P2P_STRICT
 CFLAGS += -DCONFIG_P2P_STRICT
 endif
-endif
-
 ifdef CONFIG_WIFI_DISPLAY
 CFLAGS += -DCONFIG_WIFI_DISPLAY
 OBJS += wifi_display.o
 endif
+endif
 
 ifdef CONFIG_PASN
 CFLAGS += -DCONFIG_PASN
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 79b904b66..9cfebd6f9 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -196,6 +196,7 @@ wpa_supplicant_find_hw_mode(struct wpa_supplicant *wpa_s,
 }
 
 
+#ifdef CONFIG_P2P
 static int get_max_oper_chwidth_6ghz(int chwidth)
 {
 	switch (chwidth) {
@@ -255,6 +256,7 @@ static void wpas_conf_ap_he_6ghz(struct wpa_supplicant *wpa_s,
 	    get_max_oper_chwidth_6ghz(ssid->max_oper_chwidth) >= 80)
 		wpas_conf_ap_vht(wpa_s, ssid, conf, mode);
 }
+#endif /* CONFIG_P2P */
 
 
 int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
@@ -319,7 +321,9 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
 
 		if (mode && is_6ghz_freq(ssid->frequency) &&
 		    conf->hw_mode == HOSTAPD_MODE_IEEE80211A) {
+#ifdef CONFIG_P2P
 			wpas_conf_ap_he_6ghz(wpa_s, mode, ssid, conf);
+#endif /* CONFIG_P2P */
 		} else if (!no_ht && mode && mode->ht_capab) {
 			wpa_printf(MSG_DEBUG,
 				   "Enable HT support (p2p_group=%d 11a=%d ht40_hw_capab=%d ssid->ht40=%d)",
-- 
2.25.1




More information about the Hostap mailing list