Skip to contentSkip to conversation

package/{hostapd, wpa_s}: modify config options handling

PATCH Applied Sergey Matyukevich 2 participants 2 messages Feb 17, 2022 – Mar 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/{hostapd, wpa_s}: modify config options handling

Makefiles hostapd.mk and wpa_supplicant.mk define different macros for different defconfig options. Options that are not listed in defconfig, can be set using CONFIG_SET. Options that are listed in defconfig, can be enabled or disabled using CONFIG_ENABLE or CONFIG_DISABLE. Starting from hostapd v2.10, option CONFIG_DPP is explicitly listed in defconfig. So it would be time to switch to enable/disable macros for this option.

On the other hand, this approach looks fragile: we have to track 'promoted' defconfig options for each hostapd/wpa_s update. This patch removes CONFIG_SET macros, keeping only CONFIG_ENABLED/CONFIG_DISABLED. CONFIG_SET is replaced by the additional pass over enabled options. All such options that are not listed in defconfig, will be appended to the configuration file.

Fixes:
- http://autobuild.buildroot.net/results/3f8058ee6f3913fda795578f206db895731ba1e6/

---

v1 -> v2:

- drop patch for mesh fix
- remove CONFIG_SET macro as per suggestion by Thomas

 package/hostapd/hostapd.mk               | 20 +++++++++++++-------
 package/wpa_supplicant/wpa_supplicant.mk |  9 +++++++--
 2 files changed, 20 insertions(+), 9 deletions(-)
package/hostapd/hostapd.mk +13 -7
index 075cb2a8d0..99f0cdf1b8 100644
@@ -15,7 +15,6 @@ HOSTAPD_LICENSE_FILES = README
 
 HOSTAPD_CPE_ID_VENDOR = w1.fi
 HOSTAPD_SELINUX_MODULES = hostapd
-HOSTAPD_CONFIG_SET =
 
 HOSTAPD_CONFIG_ENABLE = \
 	CONFIG_INTERNAL_LIBTOMMATH \
@@ -83,13 +82,14 @@ HOSTAPD_CONFIG_ENABLE += CONFIG_WPS
 endif
 
 ifeq ($(BR2_PACKAGE_HOSTAPD_WPA3),y)
-HOSTAPD_CONFIG_SET += \
-	CONFIG_DPP \
-	CONFIG_SAE
 HOSTAPD_CONFIG_ENABLE += \
+	CONFIG_DPP \
+	CONFIG_SAE \
 	CONFIG_OWE
 else
 HOSTAPD_CONFIG_DISABLE += \
+	CONFIG_DPP \
+	CONFIG_SAE \
 	CONFIG_OWE
 endif
 
@@ -98,8 +98,9 @@ HOSTAPD_CONFIG_ENABLE += CONFIG_NO_VLAN
 endif
 
 ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN_DYNAMIC),y)
-HOSTAPD_CONFIG_ENABLE += CONFIG_FULL_DYNAMIC_VLAN
-HOSTAPD_CONFIG_SET += NEED_LINUX_IOCTL
+HOSTAPD_CONFIG_ENABLE += \
+	CONFIG_FULL_DYNAMIC_VLAN \
+	NEED_LINUX_IOCTL
 endif
 
 ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN_NETLINK),y)
@@ -123,9 +124,14 @@ define HOSTAPD_CONFIGURE_CMDS
 	cp $(@D)/hostapd/defconfig $(HOSTAPD_CONFIG)
 	sed -i $(patsubst %,-e 's/^#\(%\)/\1/',$(HOSTAPD_CONFIG_ENABLE)) \
 		$(patsubst %,-e 's/^\(%\)/#\1/',$(HOSTAPD_CONFIG_DISABLE)) \
-		$(patsubst %,-e '1i%=y',$(HOSTAPD_CONFIG_SET)) \
 		$(patsubst %,-e %,$(HOSTAPD_CONFIG_EDITS)) \
 		$(HOSTAPD_CONFIG)
+	# set requested configuration options not listed in hostapd defconfig
+	for s in $(HOSTAPD_CONFIG_ENABLE) ; do \
+		if ! grep -q "^$${s}" $(HOSTAPD_CONFIG); then \
+			echo "$${s}=y" >> $(HOSTAPD_CONFIG) ; \
+		fi \
+	done
 endef
 
 define HOSTAPD_BUILD_CMDS
package/wpa_supplicant/wpa_supplicant.mk +7 -2
index b414144774..f0eb36e083 100644
@@ -164,7 +164,7 @@ WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_READLINE
 endif
 
 ifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO),y)
-WPA_SUPPLICANT_CONFIG_SET += CONFIG_BUILD_WPA_CLIENT_SO
+WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_BUILD_WPA_CLIENT_SO
 define WPA_SUPPLICANT_INSTALL_WPA_CLIENT_SO
 	$(INSTALL) -m 0644 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/libwpa_client.so \
 		$(TARGET_DIR)/usr/lib/libwpa_client.so
@@ -183,9 +183,14 @@ define WPA_SUPPLICANT_CONFIGURE_CMDS
 	cp $(@D)/wpa_supplicant/defconfig $(WPA_SUPPLICANT_CONFIG)
 	sed -i $(patsubst %,-e 's/^#\(%\)/\1/',$(WPA_SUPPLICANT_CONFIG_ENABLE)) \
 		$(patsubst %,-e 's/^\(%\)/#\1/',$(WPA_SUPPLICANT_CONFIG_DISABLE)) \
-		$(patsubst %,-e '1i%=y',$(WPA_SUPPLICANT_CONFIG_SET)) \
 		$(patsubst %,-e %,$(WPA_SUPPLICANT_CONFIG_EDITS)) \
 		$(WPA_SUPPLICANT_CONFIG)
+	# set requested configuration options not listed in wpa_s defconfig
+	for s in $(WPA_SUPPLICANT_CONFIG_ENABLE) ; do \
+		if ! grep -q "^$${s}" $(WPA_SUPPLICANT_CONFIG); then \
+			echo "$${s}=y" >> $(WPA_SUPPLICANT_CONFIG) ; \
+		fi \
+	done
 endef
 
 # LIBS for wpa_supplicant, LIBS_c for wpa_cli, LIBS_p for wpa_passphrase
Signature · 6 lines
2.35.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 14 lines · Sergey Matyukevich

Makefiles hostapd.mk and wpa_supplicant.mk define different macros for different defconfig options. Options that are not listed in defconfig, can be set using CONFIG_SET. Options that are listed in defconfig, can be enabled or disabled using CONFIG_ENABLE or CONFIG_DISABLE. Starting from hostapd v2.10, option CONFIG_DPP is explicitly listed in defconfig. So it would be time to switch to enable/disable macros for this option.

On the other hand, this approach looks fragile: we have to track 'promoted' defconfig options for each hostapd/wpa_s update. This patch removes CONFIG_SET macros, keeping only CONFIG_ENABLED/CONFIG_DISABLED. CONFIG_SET is replaced by the additional pass over enabled options. All such options that are not listed in defconfig, will be appended to the configuration file.

Quoted 4 lines

Fixes:
- http://autobuild.buildroot.net/results/3f8058ee6f3913fda795578f206db895731ba1e6/

Applied to master, thanks.

Regards,
Arnout

Quoted 89 lines

---

v1 -> v2:

- drop patch for mesh fix
- remove CONFIG_SET macro as per suggestion by Thomas

  package/hostapd/hostapd.mk               | 20 +++++++++++++-------
  package/wpa_supplicant/wpa_supplicant.mk |  9 +++++++--
  2 files changed, 20 insertions(+), 9 deletions(-)
package/hostapd/hostapd.mk +13 -7
index 075cb2a8d0..99f0cdf1b8 100644
@@ -15,7 +15,6 @@ HOSTAPD_LICENSE_FILES = README
 
  HOSTAPD_CPE_ID_VENDOR = w1.fi
  HOSTAPD_SELINUX_MODULES = hostapd
-HOSTAPD_CONFIG_SET =
 
  HOSTAPD_CONFIG_ENABLE = \
  	CONFIG_INTERNAL_LIBTOMMATH \
@@ -83,13 +82,14 @@ HOSTAPD_CONFIG_ENABLE += CONFIG_WPS
  endif
 
  ifeq ($(BR2_PACKAGE_HOSTAPD_WPA3),y)
-HOSTAPD_CONFIG_SET += \
-	CONFIG_DPP \
-	CONFIG_SAE
  HOSTAPD_CONFIG_ENABLE += \
+	CONFIG_DPP \
+	CONFIG_SAE \
  	CONFIG_OWE
  else
  HOSTAPD_CONFIG_DISABLE += \
+	CONFIG_DPP \
+	CONFIG_SAE \
  	CONFIG_OWE
  endif
 
@@ -98,8 +98,9 @@ HOSTAPD_CONFIG_ENABLE += CONFIG_NO_VLAN
  endif
 
  ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN_DYNAMIC),y)
-HOSTAPD_CONFIG_ENABLE += CONFIG_FULL_DYNAMIC_VLAN
-HOSTAPD_CONFIG_SET += NEED_LINUX_IOCTL
+HOSTAPD_CONFIG_ENABLE += \
+	CONFIG_FULL_DYNAMIC_VLAN \
+	NEED_LINUX_IOCTL
  endif
 
  ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN_NETLINK),y)
@@ -123,9 +124,14 @@ define HOSTAPD_CONFIGURE_CMDS
  	cp $(@D)/hostapd/defconfig $(HOSTAPD_CONFIG)
  	sed -i $(patsubst %,-e 's/^#\(%\)/\1/',$(HOSTAPD_CONFIG_ENABLE)) \
  		$(patsubst %,-e 's/^\(%\)/#\1/',$(HOSTAPD_CONFIG_DISABLE)) \
-		$(patsubst %,-e '1i%=y',$(HOSTAPD_CONFIG_SET)) \
  		$(patsubst %,-e %,$(HOSTAPD_CONFIG_EDITS)) \
  		$(HOSTAPD_CONFIG)
+	# set requested configuration options not listed in hostapd defconfig
+	for s in $(HOSTAPD_CONFIG_ENABLE) ; do \
+		if ! grep -q "^$${s}" $(HOSTAPD_CONFIG); then \
+			echo "$${s}=y" >> $(HOSTAPD_CONFIG) ; \
+		fi \
+	done
  endef
 
  define HOSTAPD_BUILD_CMDS
package/wpa_supplicant/wpa_supplicant.mk +1 -2
index b414144774..f0eb36e083 100644
@@ -164,7 +164,7 @@ WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_READLINE
  endif
 
  ifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO),y)
-WPA_SUPPLICANT_CONFIG_SET += CONFIG_BUILD_WPA_CLIENT_SO
+WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_BUILD_WPA_CLIENT_SO
  define WPA_SUPPLICANT_INSTALL_WPA_CLIENT_SO
  	$(INSTALL) -m 0644 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/libwpa_client.so \
  		$(TARGET_DIR)/usr/lib/libwpa_client.so
@@ -183,9 +183,14 @@ define WPA_SUPPLICANT_CONFIGURE_CMDS
  	cp $(@D)/wpa_supplicant/defconfig $(WPA_SUPPLICANT_CONFIG)
  	sed -i $(patsubst %,-e 's/^#\(%\)/\1/',$(WPA_SUPPLICANT_CONFIG_ENABLE)) \
  		$(patsubst %,-e 's/^\(%\)/#\1/',$(WPA_SUPPLICANT_CONFIG_DISABLE)) \
-		$(patsubst %,-e '1i%=y',$(WPA_SUPPLICANT_CONFIG_SET)) \
  		$(patsubst %,-e %,$(WPA_SUPPLICANT_CONFIG_EDITS)) \

package/wpa_supplicant/wpa_supplicant.mk define WPA_SUPPLICANT_CONFIGURE_CMDS · line 196

Quoted 10 lines
package/wpa_supplicant/wpa_supplicant.mk +6 -0
  		$(WPA_SUPPLICANT_CONFIG)
+	# set requested configuration options not listed in wpa_s defconfig
+	for s in $(WPA_SUPPLICANT_CONFIG_ENABLE) ; do \
+		if ! grep -q "^$${s}" $(WPA_SUPPLICANT_CONFIG); then \
+			echo "$${s}=y" >> $(WPA_SUPPLICANT_CONFIG) ; \
+		fi \
+	done
  endef
 
  # LIBS for wpa_supplicant, LIBS_c for wpa_cli, LIBS_p for wpa_passphrase

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot