Skip to contentSkip to conversation

hostapd: driver selection options

PATCH New Alexander Mukhin 4 participants 11 messages Dec 30, 2017 – Apr 2, 2018

lore
Share & tools
lore
#0 lore raw

cover hostapd: driver selection options

Below is the list of patches for hostapd to give user more control on which drivers to include in the build. As a byproduct, we can drop dependencies on netlink and threads if the drivers and options selected do not require them.

Alexander Mukhin (3):
hostapd: select driver support
hostapd: make ACS dependent on nl80211
hostapd: drop default dependency on netlink

 package/hostapd/Config.in  | 52 +++++++++++++++++++++++++++++++++++-----
 package/hostapd/hostapd.mk | 59 +++++++++++++++++++++++++++++++++-------------
 2 files changed, 88 insertions(+), 23 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 hostapd: select driver support

Add support for the wired driver. Add configuration options to select which drivers to build. Select DRIVER_NONE if no other drivers enabled (this may be the case when building hostapd as a standalone RADIUS server).

Update makefile logic and apply wireless-specific options only if at least one wireless driver enabled. Otherwise, an attempt to build a wired-only or RADIUS-only hostapd will fail.

---
 package/hostapd/Config.in  | 31 +++++++++++++++++++++++++++++++
 package/hostapd/hostapd.mk | 31 ++++++++++++++++++++++++++-----
 2 files changed, 57 insertions(+), 5 deletions(-)
package/hostapd/Config.in +31 -0
index 84156e8f11..f6182a9268 100644
@@ -14,11 +14,42 @@ config BR2_PACKAGE_HOSTAPD
 
 if BR2_PACKAGE_HOSTAPD
 
+config BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP
+	bool "Enable hostap driver"
+	default y
+	select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
+	help
+	  Enable support for Host AP driver.
+
+config BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
+	bool "Enable nl80211 driver"
+	default y
+	select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
+	help
+	  Enable support for drivers using the nl80211 kernel interface.
+
 config BR2_PACKAGE_HOSTAPD_DRIVER_RTW
 	bool "Enable rtl871xdrv driver"
+	select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
 	help
 	  Enable support for Realtek wireless chips.
 
+config BR2_PACKAGE_HOSTAPD_DRIVER_WIRED
+	bool "Enable wired driver"
+	help
+	  Enable support for wired authenticator.
+
+config BR2_PACKAGE_HOSTAPD_DRIVER_NONE
+	bool
+	default y
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_RTW
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_WIRED
+
+config BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
+	bool
+
 config BR2_PACKAGE_HOSTAPD_ACS
 	bool "Enable ACS"
 	default y
package/hostapd/hostapd.mk +26 -5
index 1696670383..f9072784eb 100644
@@ -18,12 +18,7 @@ HOSTAPD_LICENSE_FILES = README
 HOSTAPD_CONFIG_SET =
 
 HOSTAPD_CONFIG_ENABLE = \
-	CONFIG_HS20 \
-	CONFIG_IEEE80211AC \
-	CONFIG_IEEE80211N \
-	CONFIG_IEEE80211R \
 	CONFIG_INTERNAL_LIBTOMMATH \
-	CONFIG_INTERWORKING \
 	CONFIG_LIBNL32
 
 HOSTAPD_CONFIG_DISABLE =
@@ -45,11 +40,37 @@ HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD
 HOSTAPD_CONFIG_EDITS += 's/\#\(CONFIG_TLS=\).*/\1internal/'
 endif
 
+ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP),)
+HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_HOSTAP
+endif
+
+ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_NL80211),)
+HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_NL80211
+endif
+
 ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_RTW),y)
 HOSTAPD_PATCH += https://github.com/pritambaral/hostapd-rtl871xdrv/raw/master/rtlxdrv.patch
 HOSTAPD_CONFIG_SET += CONFIG_DRIVER_RTW
 endif
 
+ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_WIRED),y)
+HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_WIRED
+endif
+
+ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_NONE),y)
+HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_NONE
+endif
+
+# Add options for wireless drivers
+ifeq ($(BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS),y)
+HOSTAPD_CONFIG_ENABLE += \
+	CONFIG_HS20 \
+	CONFIG_IEEE80211AC \
+	CONFIG_IEEE80211N \
+	CONFIG_IEEE80211R \
+	CONFIG_INTERWORKING
+endif
+
 ifeq ($(BR2_PACKAGE_HOSTAPD_ACS),y)
 HOSTAPD_CONFIG_ENABLE += CONFIG_ACS
 endif
Signature · 1 line
2.11.0
#3 lore raw

PATCH 1/3 hostapd: select driver support

In reply to Alexander Mukhin
Quoted 10 lines · Alexander Mukhin

Add support for the wired driver. Add configuration options to select which drivers to build. Select DRIVER_NONE if no other drivers enabled (this may be the case when building hostapd as a standalone RADIUS server).

Update makefile logic and apply wireless-specific options only if at least one wireless driver enabled. Otherwise, an attempt to build a wired-only or RADIUS-only hostapd will fail.

Quoted 114 lines
---
 package/hostapd/Config.in  | 31 +++++++++++++++++++++++++++++++
 package/hostapd/hostapd.mk | 31 ++++++++++++++++++++++++++-----
 2 files changed, 57 insertions(+), 5 deletions(-)
package/hostapd/Config.in +31 -0
index 84156e8f11..f6182a9268 100644
@@ -14,11 +14,42 @@ config BR2_PACKAGE_HOSTAPD
 
 if BR2_PACKAGE_HOSTAPD
 
+config BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP
+       bool "Enable hostap driver"
+       default y
+       select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
+       help
+         Enable support for Host AP driver.
+
+config BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
+       bool "Enable nl80211 driver"
+       default y
+       select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
+       help
+         Enable support for drivers using the nl80211 kernel interface.
+
 config BR2_PACKAGE_HOSTAPD_DRIVER_RTW
        bool "Enable rtl871xdrv driver"
+       select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
        help
          Enable support for Realtek wireless chips.
 
+config BR2_PACKAGE_HOSTAPD_DRIVER_WIRED
+       bool "Enable wired driver"
+       help
+         Enable support for wired authenticator.
+
+config BR2_PACKAGE_HOSTAPD_DRIVER_NONE
+       bool
+       default y
+       depends on !BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP
+       depends on !BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
+       depends on !BR2_PACKAGE_HOSTAPD_DRIVER_RTW
+       depends on !BR2_PACKAGE_HOSTAPD_DRIVER_WIRED
+
+config BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
+       bool
+
 config BR2_PACKAGE_HOSTAPD_ACS
        bool "Enable ACS"
        default y
package/hostapd/hostapd.mk +26 -6
index 1696670383..f9072784eb 100644
@@ -18,12 +18,7 @@ HOSTAPD_LICENSE_FILES = README
 HOSTAPD_CONFIG_SET =
 
 HOSTAPD_CONFIG_ENABLE = \
-       CONFIG_HS20 \
-       CONFIG_IEEE80211AC \
-       CONFIG_IEEE80211N \
-       CONFIG_IEEE80211R \
        CONFIG_INTERNAL_LIBTOMMATH \
-       CONFIG_INTERWORKING \
        CONFIG_LIBNL32
 
 HOSTAPD_CONFIG_DISABLE =
@@ -45,11 +40,37 @@ HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD
 HOSTAPD_CONFIG_EDITS += 's/\#\(CONFIG_TLS=\).*/\1internal/'
 endif
 
+ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP),)
+HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_HOSTAP
+endif
+
+ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_NL80211),)
+HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_NL80211
+endif
+
 ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_RTW),y)
 HOSTAPD_PATCH += https://github.com/pritambaral/hostapd-rtl871xdrv/raw/master/rtlxdrv.patch
 HOSTAPD_CONFIG_SET += CONFIG_DRIVER_RTW
 endif
 
+ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_WIRED),y)
+HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_WIRED
+endif
+
+ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_NONE),y)
+HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_NONE
+endif
+
+# Add options for wireless drivers
+ifeq ($(BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS),y)
+HOSTAPD_CONFIG_ENABLE += \
+       CONFIG_HS20 \
+       CONFIG_IEEE80211AC \
+       CONFIG_IEEE80211N \
+       CONFIG_IEEE80211R \
+       CONFIG_INTERWORKING
+endif
+
 ifeq ($(BR2_PACKAGE_HOSTAPD_ACS),y)
 HOSTAPD_CONFIG_ENABLE += CONFIG_ACS
 endif
--

2.11.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw

PATCH 2/3 hostapd: make ACS dependent on nl80211

In reply to Alexander Mukhin

According to hostapd's defconfig file, ACS is currently only supported through the nl80211 driver. Search through the source code also confirms that ACS machinery is present in the nl80211 driver only.

Although hostapd can be built with ACS enabled and nl80211 disabled, an attempt to use ACS with other drivers by setting a wireless channel to 0 results in a runtime failure (driver doesn't accept this value). So we might save a user from selecting a meaningless combination by making ACS dependent on nl80211.

---
 package/hostapd/Config.in | 4 ++++
 1 file changed, 4 insertions(+)
package/hostapd/Config.in +4 -0
index f6182a9268..d23e5e1dca 100644
@@ -53,6 +53,7 @@ config BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
 config BR2_PACKAGE_HOSTAPD_ACS
 	bool "Enable ACS"
 	default y
+	depends on BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
 	help
 	  Enable support for standard ACS (Automatic Channel Selection).
 	  Some propietary drivers use a custom algorithm which requires
@@ -60,6 +61,9 @@ config BR2_PACKAGE_HOSTAPD_ACS
 	  causing hostapd to use the standard one which doesn't work
 	  for those cases.
 
+comment "ACS is currently only supported through the nl80211 driver"
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
+
 config BR2_PACKAGE_HOSTAPD_EAP
 	bool "Enable EAP"
 	depends on !BR2_STATIC_LIBS
Signature · 1 line
2.11.0
#5 lore raw

PATCH 2/3 hostapd: make ACS dependent on nl80211

+Sam

Quoted 11 lines · Alexander Mukhin

According to hostapd's defconfig file, ACS is currently only supported through the nl80211 driver. Search through the source code also confirms that ACS machinery is present in the nl80211 driver only.

Although hostapd can be built with ACS enabled and nl80211 disabled, an attempt to use ACS with other drivers by setting a wireless channel to 0 results in a runtime failure (driver doesn't accept this value). So we might save a user from selecting a meaningless combination by making ACS dependent on nl80211.

Bryce Ferguson
Software Engineer
Airborne Information Solutions \ RC Linux Platform

400 Collins Rd NE Cedar Rapids, Iowa 52498

Bryce.Ferguson at rockwellcollins.com

#6 lore raw

PATCH 2/3 hostapd: make ACS dependent on nl80211

In reply to Alexander Mukhin
Quoted 11 lines · Alexander Mukhin

According to hostapd's defconfig file, ACS is currently only supported through the nl80211 driver. Search through the source code also confirms that ACS machinery is present in the nl80211 driver only.

Although hostapd can be built with ACS enabled and nl80211 disabled, an attempt to use ACS with other drivers by setting a wireless channel to 0 results in a runtime failure (driver doesn't accept this value). So we might save a user from selecting a meaningless combination by making ACS dependent on nl80211.

Quoted 33 lines
---
 package/hostapd/Config.in | 4 ++++
 1 file changed, 4 insertions(+)
package/hostapd/Config.in +4 -1
index f6182a9268..d23e5e1dca 100644
@@ -53,6 +53,7 @@ config BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
 config BR2_PACKAGE_HOSTAPD_ACS
        bool "Enable ACS"
        default y
+       depends on BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
        help
          Enable support for standard ACS (Automatic Channel Selection).
          Some propietary drivers use a custom algorithm which requires
@@ -60,6 +61,9 @@ config BR2_PACKAGE_HOSTAPD_ACS
          causing hostapd to use the standard one which doesn't work
          for those cases.
 
+comment "ACS is currently only supported through the nl80211 driver"
+       depends on !BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
+
 config BR2_PACKAGE_HOSTAPD_EAP
        bool "Enable EAP"
        depends on !BR2_STATIC_LIBS
--

2.11.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#7 lore raw

PATCH 3/3 hostapd: drop default dependency on netlink

In reply to Alexander Mukhin

Get rid of netlink dependency if the options selected allow that.

---
 package/hostapd/Config.in  | 17 +++++++++++------
 package/hostapd/hostapd.mk | 28 ++++++++++++++++------------
 2 files changed, 27 insertions(+), 18 deletions(-)
package/hostapd/Config.in +11 -6
index d23e5e1dca..d60ed08cd6 100644
@@ -1,8 +1,6 @@
 config BR2_PACKAGE_HOSTAPD
 	bool "hostapd"
-	depends on BR2_TOOLCHAIN_HAS_THREADS # libnl
 	depends on BR2_USE_MMU # fork()
-	select BR2_PACKAGE_LIBNL
 	help
 	  User space daemon for wireless access points.
 
@@ -24,10 +22,15 @@ config BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP
 config BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
 	bool "Enable nl80211 driver"
 	default y
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libnl
+	select BR2_PACKAGE_LIBNL
 	select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
 	help
 	  Enable support for drivers using the nl80211 kernel interface.
 
+comment "nl80211 driver needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
 config BR2_PACKAGE_HOSTAPD_DRIVER_RTW
 	bool "Enable rtl871xdrv driver"
 	select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
@@ -97,12 +100,14 @@ config BR2_PACKAGE_HOSTAPD_VLAN_NETLINK
 	bool "Use netlink-based API for VLAN operations"
 	default y
 	depends on BR2_PACKAGE_HOSTAPD_VLAN
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libnl
+	select BR2_PACKAGE_LIBNL
 	help
 	  Use netlink-based kernel API for VLAN operations
 	  instead of ioctl().
 
-endif
-
-comment "hostapd needs a toolchain w/ threads"
+comment "netlink-based VLAN support needs a toolchain w/ threads"
+	depends on BR2_PACKAGE_HOSTAPD_VLAN
 	depends on !BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_USE_MMU
+
+endif
package/hostapd/hostapd.mk +16 -12
index f9072784eb..fa8226805d 100644
@@ -11,25 +11,16 @@ HOSTAPD_PATCH = \
 	http://w1.fi/security/2017-1/rebased-v2.6-0005-Fix-PTK-rekeying-to-generate-a-new-ANonce.patch
 HOSTAPD_SUBDIR = hostapd
 HOSTAPD_CONFIG = $(HOSTAPD_DIR)/$(HOSTAPD_SUBDIR)/.config
-HOSTAPD_DEPENDENCIES = host-pkgconf libnl
-HOSTAPD_CFLAGS = $(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/libnl3/
+HOSTAPD_DEPENDENCIES = host-pkgconf
+HOSTAPD_CFLAGS = $(TARGET_CFLAGS)
 HOSTAPD_LICENSE = BSD-3-Clause
 HOSTAPD_LICENSE_FILES = README
 HOSTAPD_CONFIG_SET =
 
-HOSTAPD_CONFIG_ENABLE = \
-	CONFIG_INTERNAL_LIBTOMMATH \
-	CONFIG_LIBNL32
+HOSTAPD_CONFIG_ENABLE = CONFIG_INTERNAL_LIBTOMMATH
 
 HOSTAPD_CONFIG_DISABLE =
 
-# libnl-3 needs -lm (for rint) and -lpthread if linking statically
-# And library order matters hence stick -lnl-3 first since it's appended
-# in the hostapd Makefiles as in LIBS+=-lnl-3 ... thus failing
-ifeq ($(BR2_STATIC_LIBS),y)
-HOSTAPD_LIBS += -lnl-3 -lm -lpthread
-endif
-
 # Try to use openssl if it's already available
 ifeq ($(BR2_PACKAGE_LIBOPENSSL),y)
 HOSTAPD_DEPENDENCIES += libopenssl
@@ -105,6 +96,19 @@ ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN_NETLINK),y)
 HOSTAPD_CONFIG_ENABLE += CONFIG_VLAN_NETLINK
 endif
 
+# Options for building with libnl
+ifeq ($(BR2_PACKAGE_LIBNL),y)
+HOSTAPD_DEPENDENCIES += libnl
+HOSTAPD_CFLAGS += -I$(STAGING_DIR)/usr/include/libnl3/
+HOSTAPD_CONFIG_ENABLE += CONFIG_LIBNL32
+# libnl-3 needs -lm (for rint) and -lpthread if linking statically
+# And library order matters hence stick -lnl-3 first since it's appended
+# in the hostapd Makefiles as in LIBS+=-lnl-3 ... thus failing
+ifeq ($(BR2_STATIC_LIBS),y)
+HOSTAPD_LIBS += -lnl-3 -lm -lpthread
+endif
+endif
+
 define HOSTAPD_CONFIGURE_CMDS
 	cp $(@D)/hostapd/defconfig $(HOSTAPD_CONFIG)
 	sed -i $(patsubst %,-e 's/^#\(%\)/\1/',$(HOSTAPD_CONFIG_ENABLE)) \
Signature · 1 line
2.11.0
#8 lore raw

PATCH 3/3 hostapd: drop default dependency on netlink

Quoted 3 lines · Alexander Mukhin

Get rid of netlink dependency if the options selected allow that.

Quoted 113 lines
---
 package/hostapd/Config.in  | 17 +++++++++++------
 package/hostapd/hostapd.mk | 28 ++++++++++++++++------------
 2 files changed, 27 insertions(+), 18 deletions(-)
package/hostapd/Config.in +11 -6
index d23e5e1dca..d60ed08cd6 100644
@@ -1,8 +1,6 @@
 config BR2_PACKAGE_HOSTAPD
        bool "hostapd"
-       depends on BR2_TOOLCHAIN_HAS_THREADS # libnl
        depends on BR2_USE_MMU # fork()
-       select BR2_PACKAGE_LIBNL
        help
          User space daemon for wireless access points.
 
@@ -24,10 +22,15 @@ config BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP
 config BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
        bool "Enable nl80211 driver"
        default y
+       depends on BR2_TOOLCHAIN_HAS_THREADS # libnl
+       select BR2_PACKAGE_LIBNL
        select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
        help
          Enable support for drivers using the nl80211 kernel interface.
 
+comment "nl80211 driver needs a toolchain w/ threads"
+       depends on !BR2_TOOLCHAIN_HAS_THREADS
+
 config BR2_PACKAGE_HOSTAPD_DRIVER_RTW
        bool "Enable rtl871xdrv driver"
        select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
@@ -97,12 +100,14 @@ config BR2_PACKAGE_HOSTAPD_VLAN_NETLINK
        bool "Use netlink-based API for VLAN operations"
        default y
        depends on BR2_PACKAGE_HOSTAPD_VLAN
+       depends on BR2_TOOLCHAIN_HAS_THREADS # libnl
+       select BR2_PACKAGE_LIBNL
        help
          Use netlink-based kernel API for VLAN operations
          instead of ioctl().
 
-endif
-
-comment "hostapd needs a toolchain w/ threads"
+comment "netlink-based VLAN support needs a toolchain w/ threads"
+       depends on BR2_PACKAGE_HOSTAPD_VLAN
        depends on !BR2_TOOLCHAIN_HAS_THREADS
-       depends on BR2_USE_MMU
+
+endif
package/hostapd/hostapd.mk +16 -13
index f9072784eb..fa8226805d 100644
@@ -11,25 +11,16 @@ HOSTAPD_PATCH = \
        http://w1.fi/security/2017-1/rebased-v2.6-0005-Fix-PTK-rekeying-to-generate-a-new-ANonce.patch
 HOSTAPD_SUBDIR = hostapd
 HOSTAPD_CONFIG = $(HOSTAPD_DIR)/$(HOSTAPD_SUBDIR)/.config
-HOSTAPD_DEPENDENCIES = host-pkgconf libnl
-HOSTAPD_CFLAGS = $(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/libnl3/
+HOSTAPD_DEPENDENCIES = host-pkgconf
+HOSTAPD_CFLAGS = $(TARGET_CFLAGS)
 HOSTAPD_LICENSE = BSD-3-Clause
 HOSTAPD_LICENSE_FILES = README
 HOSTAPD_CONFIG_SET =
 
-HOSTAPD_CONFIG_ENABLE = \
-       CONFIG_INTERNAL_LIBTOMMATH \
-       CONFIG_LIBNL32
+HOSTAPD_CONFIG_ENABLE = CONFIG_INTERNAL_LIBTOMMATH
 
 HOSTAPD_CONFIG_DISABLE =
 
-# libnl-3 needs -lm (for rint) and -lpthread if linking statically
-# And library order matters hence stick -lnl-3 first since it's appended
-# in the hostapd Makefiles as in LIBS+=-lnl-3 ... thus failing
-ifeq ($(BR2_STATIC_LIBS),y)
-HOSTAPD_LIBS += -lnl-3 -lm -lpthread
-endif
-
 # Try to use openssl if it's already available
 ifeq ($(BR2_PACKAGE_LIBOPENSSL),y)
 HOSTAPD_DEPENDENCIES += libopenssl
@@ -105,6 +96,19 @@ ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN_NETLINK),y)
 HOSTAPD_CONFIG_ENABLE += CONFIG_VLAN_NETLINK
 endif
 
+# Options for building with libnl
+ifeq ($(BR2_PACKAGE_LIBNL),y)
+HOSTAPD_DEPENDENCIES += libnl
+HOSTAPD_CFLAGS += -I$(STAGING_DIR)/usr/include/libnl3/
+HOSTAPD_CONFIG_ENABLE += CONFIG_LIBNL32
+# libnl-3 needs -lm (for rint) and -lpthread if linking statically
+# And library order matters hence stick -lnl-3 first since it's appended
+# in the hostapd Makefiles as in LIBS+=-lnl-3 ... thus failing
+ifeq ($(BR2_STATIC_LIBS),y)
+HOSTAPD_LIBS += -lnl-3 -lm -lpthread
+endif
+endif
+
 define HOSTAPD_CONFIGURE_CMDS
        cp $(@D)/hostapd/defconfig $(HOSTAPD_CONFIG)
        sed -i $(patsubst %,-e 's/^#\(%\)/\1/',$(HOSTAPD_CONFIG_ENABLE)) \
--

2.11.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#10 lore raw

cover hostapd: driver selection options

In reply to Alexander Mukhin

Hello,

Quoted 4 lines · Alexander Mukhin

Alexander Mukhin (3):
hostapd: select driver support
hostapd: make ACS dependent on nl80211
hostapd: drop default dependency on netlink

Series applied, thanks. On the last patch, we just did a minor tweak to use a if BR2_PACKAGE_HOSTAPD_VLAN ... endif block instead of duplicating the depends on dependency.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com