Skip to contentSkip to conversation

hostapd: new configuration options

PATCH New Alexander Mukhin 3 participants 19 messages Dec 23, 2017 – Dec 30, 2017

lore
Share & tools
lore
#0 lore raw

cover hostapd: new configuration options

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

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

 package/hostapd/Config.in  | 58 ++++++++++++++++++++++++++++++++++++++++++----
 package/hostapd/hostapd.mk | 51 ++++++++++++++++++++++++++++++----------
 2 files changed, 92 insertions(+), 17 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/4 hostapd: select VLAN support

Add configuration options for hostapd to select which kind of VLAN support to build.

---
 package/hostapd/Config.in  | 23 +++++++++++++++++++++++
 package/hostapd/hostapd.mk | 16 +++++++++++++---
 2 files changed, 36 insertions(+), 3 deletions(-)
package/hostapd/Config.in +23 -0
index 40c7015e73..84156e8f11 100644
@@ -43,6 +43,29 @@ config BR2_PACKAGE_HOSTAPD_WPS
 	help
 	  Enable support for Wi-Fi Protected Setup.
 
+config BR2_PACKAGE_HOSTAPD_VLAN
+	bool "Enable VLAN support"
+	default y
+	help
+	  Enable support for VLANs.
+
+config BR2_PACKAGE_HOSTAPD_VLAN_DYNAMIC
+	bool "Enable dynamic VLAN support"
+	default y
+	depends on BR2_PACKAGE_HOSTAPD_VLAN
+	help
+	  Enable support for fully dynamic VLANs.
+	  This enables hostapd to automatically create
+	  bridge and VLAN interfaces if necessary.
+
+config BR2_PACKAGE_HOSTAPD_VLAN_NETLINK
+	bool "Use netlink-based API for VLAN operations"
+	default y
+	depends on BR2_PACKAGE_HOSTAPD_VLAN
+	help
+	  Use netlink-based kernel API for VLAN operations
+	  instead of ioctl().
+
 endif
 
 comment "hostapd needs a toolchain w/ threads"
package/hostapd/hostapd.mk +13 -3
index 0ed1631421..04ffa35758 100644
@@ -18,15 +18,13 @@ HOSTAPD_LICENSE_FILES = README
 HOSTAPD_CONFIG_SET =
 
 HOSTAPD_CONFIG_ENABLE = \
-	CONFIG_FULL_DYNAMIC_VLAN \
 	CONFIG_HS20 \
 	CONFIG_IEEE80211AC \
 	CONFIG_IEEE80211N \
 	CONFIG_IEEE80211R \
 	CONFIG_INTERNAL_LIBTOMMATH \
 	CONFIG_INTERWORKING \
-	CONFIG_LIBNL32 \
-	CONFIG_VLAN_NETLINK
+	CONFIG_LIBNL32
 
 HOSTAPD_CONFIG_DISABLE =
 
@@ -74,6 +72,18 @@ ifeq ($(BR2_PACKAGE_HOSTAPD_WPS),y)
 HOSTAPD_CONFIG_ENABLE += CONFIG_WPS
 endif
 
+ifneq ($(BR2_PACKAGE_HOSTAPD_VLAN),y)
+HOSTAPD_CONFIG_ENABLE += CONFIG_NO_VLAN
+endif
+
+ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN_DYNAMIC),y)
+HOSTAPD_CONFIG_ENABLE += CONFIG_FULL_DYNAMIC_VLAN
+endif
+
+ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN_NETLINK),y)
+HOSTAPD_CONFIG_ENABLE += CONFIG_VLAN_NETLINK
+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
#2 lore raw

PATCH 1/4 hostapd: select VLAN support

Hello,

Quoted 1 line · Alexander Mukhin

+ifneq ($(BR2_PACKAGE_HOSTAPD_VLAN),y)

This is better written as:

ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN),)

So I've fixed that, and applied your patch. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH 2/4 hostapd: select driver support

In reply to Alexander Mukhin

Add configuration options for hostapd to select which drivers to build.

---
 package/hostapd/Config.in  | 17 +++++++++++++++++
 package/hostapd/hostapd.mk |  8 ++++++++
 2 files changed, 25 insertions(+)
package/hostapd/Config.in +17 -0
index 84156e8f11..509797a44a 100644
@@ -14,11 +14,28 @@ config BR2_PACKAGE_HOSTAPD
 
 if BR2_PACKAGE_HOSTAPD
 
+config BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP
+	bool "Enable hostap driver"
+	default y
+	help
+	  Enable support for Host AP driver.
+
+config BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
+	bool "Enable nl80211 driver"
+	default y
+	help
+	  Enable support for drivers using the nl80211 kernel interface.
+
 config BR2_PACKAGE_HOSTAPD_DRIVER_RTW
 	bool "Enable rtl871xdrv driver"
 	help
 	  Enable support for Realtek wireless chips.
 
+comment "at least one driver must be selected"
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_RTW
+
 config BR2_PACKAGE_HOSTAPD_ACS
 	bool "Enable ACS"
 	default y
package/hostapd/hostapd.mk +8 -0
index 04ffa35758..143efe9627 100644
@@ -45,6 +45,14 @@ HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD
 HOSTAPD_CONFIG_EDITS += 's/\#\(CONFIG_TLS=\).*/\1internal/'
 endif
 
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP),y)
+HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_HOSTAP
+endif
+
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_NL80211),y)
+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
Signature · 1 line
2.11.0
#4 lore raw

PATCH 2/4 hostapd: select driver support

Hello Alexander,

Quoted 4 lines

Add configuration options for hostapd to select which drivers to build.

[...]

package/hostapd/Config.in config BR2_PACKAGE_HOSTAPD · line 38

Quoted 5 lines
package/hostapd/Config.in +5 -0
+comment "at least one driver must be selected"
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_NL80211
+	depends on !BR2_PACKAGE_HOSTAPD_DRIVER_RTW
+

Does it makes sense to enforce enablement of at least one driver ?

Another option would be to add DRIVER_NONE to the list of drivers, and enable it by default if no other actual wired/wireless driver has been selected. According to example hostapd.conf only 'none' driver is needed if hostapd is built as a standalone RADIUS server.

Regards,
Sergey

#5 lore raw

PATCH 2/4 hostapd: select driver support

Hello Sergey,

Quoted 6 lines

Does it makes sense to enforce enablement of at least one driver ?

Another option would be to add DRIVER_NONE to the list of drivers, and enable it by default if no other actual wired/wireless driver has been selected. According to example hostapd.conf only 'none' driver is needed if hostapd is built as a standalone RADIUS server.

Yes, I agree with you.
I'll send a patch for that.

Signature · 2 lines
Cheers,
Alexander.
#6 lore raw

PATCH 1/2 hostapd: add support for wired driver

In reply to Sergey Matyukevich

Add support for the wired authenticator (disabled by default).

---

These patches are meant to be applied after the series I sent before (see hostapd: new configuration options)

 package/hostapd/Config.in  | 7 +++++++
 package/hostapd/hostapd.mk | 4 ++++
 2 files changed, 11 insertions(+)
package/hostapd/Config.in +7 -0
index 115563f564..bfb5447c1e 100644
@@ -34,10 +34,17 @@ config BR2_PACKAGE_HOSTAPD_DRIVER_RTW
 	help
 	  Enable support for Realtek wireless chips.
 
+config BR2_PACKAGE_HOSTAPD_DRIVER_WIRED
+	bool "Enable wired driver"
+	default y
+	help
+	  Enable support for wired authenticator.
+
 comment "at least one driver must be selected"
 	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_ACS
 	bool "Enable ACS"
package/hostapd/hostapd.mk +4 -0
index 9b73c596f8..1700335c1a 100644
@@ -54,6 +54,10 @@ HOSTAPD_PATCH += https://github.com/pritambaral/hostapd-rtl871xdrv/raw/master/rt
 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_ACS),y)
 HOSTAPD_CONFIG_ENABLE += CONFIG_ACS
 endif
Signature · 1 line
2.11.0
#7 lore raw

PATCH 1/2 hostapd: add support for wired driver

Hello,

Quoted 1 line · Alexander Mukhin

Add support for the wired authenticator (disabled by default).

disabled by default...

Quoted 2 lines

These patches are meant to be applied after the series I sent before (see hostapd: new configuration options)

Could you please send a single series instead ? This makes the dependency much clearer.

package/hostapd/Config.in config BR2_PACKAGE_HOSTAPD_DRIVER_RTW · line 39

Quoted 3 lines
package/hostapd/Config.in +3 -0
+config BR2_PACKAGE_HOSTAPD_DRIVER_WIRED
+	bool "Enable wired driver"
+	default y

... but you're defaulting to "y".

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#8 lore raw

PATCH 2/2 hostapd: select DRIVER_NONE if no other drivers enabled

In reply to Sergey Matyukevich

Select DRIVER_NONE if no wireless or wired drivers selected. This may be the case when building hostapd as a standalone RADIUS server.

Apply wireless-specific options only if we have at least one wireless driver enabled. Otherwise, an attempt to build a wired-only or RADIUS-only hostapd will fail.

---
 package/hostapd/Config.in  |  6 ------
 package/hostapd/hostapd.mk | 36 +++++++++++++++++++++++++++++-------
 2 files changed, 29 insertions(+), 13 deletions(-)
package/hostapd/Config.in +0 -6
index bfb5447c1e..2ce26e79aa 100644
@@ -40,12 +40,6 @@ config BR2_PACKAGE_HOSTAPD_DRIVER_WIRED
 	help
 	  Enable support for wired authenticator.
 
-comment "at least one driver must be selected"
-	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_ACS
 	bool "Enable ACS"
 	default y
package/hostapd/hostapd.mk +29 -7
index 1700335c1a..e6c981dbe5 100644
@@ -17,18 +17,14 @@ HOSTAPD_LICENSE = BSD-3-Clause
 HOSTAPD_LICENSE_FILES = README
 HOSTAPD_CONFIG_SET =
 
-HOSTAPD_CONFIG_ENABLE = \
-	CONFIG_HS20 \
-	CONFIG_IEEE80211AC \
-	CONFIG_IEEE80211N \
-	CONFIG_IEEE80211R \
-	CONFIG_INTERNAL_LIBTOMMATH \
-	CONFIG_INTERWORKING
+HOSTAPD_CONFIG_ENABLE = CONFIG_INTERNAL_LIBTOMMATH
 
 HOSTAPD_CONFIG_DISABLE =
 
 HOSTAPD_USE_NL =
 
+HOSTAPD_USE_WIRELESS_DRIVERS =
+
 # Try to use openssl if it's already available
 ifeq ($(BR2_PACKAGE_LIBOPENSSL),y)
 HOSTAPD_DEPENDENCIES += libopenssl
@@ -39,25 +35,51 @@ HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD
 HOSTAPD_CONFIG_EDITS += 's/\#\(CONFIG_TLS=\).*/\1internal/'
 endif
 
+# Select which drivers to build
 ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP),y)
 HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_HOSTAP
+else
+HOSTAPD_USE_WIRELESS_DRIVERS = y
 endif
 
 ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_NL80211),y)
 HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_NL80211
 else
 HOSTAPD_USE_NL = y
+HOSTAPD_USE_WIRELESS_DRIVERS = y
 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
+HOSTAPD_USE_WIRELESS_DRIVERS = y
 endif
 
 ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_WIRED),y)
 HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_WIRED
 endif
 
+# Enable CONFIG_DRIVER_NONE if no other drivers enabled
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP),y)
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_NL80211),y)
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_RTW),y)
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_WIRED),y)
+HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_NONE
+endif
+endif
+endif
+endif
+
+# Add options for wireless drivers
+ifeq ($(HOSTAPD_USE_WIRELESS_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
#9 lore raw

PATCH 2/2 hostapd: select DRIVER_NONE if no other drivers enabled

Hello,

Quoted 12 lines · Alexander Mukhin
package/hostapd/hostapd.mk +0 -4
index 1700335c1a..e6c981dbe5 100644
@@ -17,18 +17,14 @@ HOSTAPD_LICENSE = BSD-3-Clause
 HOSTAPD_LICENSE_FILES = README
 HOSTAPD_CONFIG_SET =
 
-HOSTAPD_CONFIG_ENABLE = \
-	CONFIG_HS20 \
-	CONFIG_IEEE80211AC \
-	CONFIG_IEEE80211N \

package/hostapd/hostapd.mk HOSTAPD_LICENSE = BSD-3-Clause · line 26

Quoted 10 lines
package/hostapd/hostapd.mk +2 -3
-	CONFIG_IEEE80211R \
-	CONFIG_INTERNAL_LIBTOMMATH \
-	CONFIG_INTERWORKING
+HOSTAPD_CONFIG_ENABLE = CONFIG_INTERNAL_LIBTOMMATH
 
 HOSTAPD_CONFIG_DISABLE =
 
 HOSTAPD_USE_NL =
 
+HOSTAPD_USE_WIRELESS_DRIVERS =

I think this would be better handled via a hidden Config.in option, something like:

config BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS
bool

config BR2_PACKAGE_HOSTAPD_<something>
bool "something"
select BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS

package/hostapd/hostapd.mk HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD · line 66

Quoted 5 lines
package/hostapd/hostapd.mk +5 -0
+# Enable CONFIG_DRIVER_NONE if no other drivers enabled
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_HOSTAP),y)
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_NL80211),y)
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_RTW),y)
+ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_WIRED),y)

Perhaps this could be simplified to:

ifeq ($(BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS)$(BR2_PACKAGE_HOSTAPD_DRIVER_WIRED),)

package/hostapd/hostapd.mk HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD · line 74

Quoted 8 lines
package/hostapd/hostapd.mk +8 -0
+HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_NONE
+endif
+endif
+endif
+endif
+
+# Add options for wireless drivers
+ifeq ($(HOSTAPD_USE_WIRELESS_DRIVERS),y)

This would use BR2_PACKAGE_HOSTAPD_HAS_WIFI_DRIVERS.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#10 lore raw

PATCH 2/4 hostapd: select driver support

In reply to Alexander Mukhin

Hello,

Quoted 4 lines · Alexander Mukhin

Add configuration options for hostapd to select which drivers to build.

Since you got some feedback on this patch, could you send a new iteration of your hostapd series ? It should also include the two other patches you sent as a separate series, to be clearer.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#11 lore raw

PATCH 3/4 hostapd: make ACS dependent on nl80211

In reply to Alexander Mukhin

ACS is supported for nl80211 driver only.

---
 package/hostapd/Config.in | 4 ++++
 1 file changed, 4 insertions(+)
package/hostapd/Config.in +4 -0
index 509797a44a..57cec469c6 100644
@@ -39,6 +39,7 @@ comment "at least one driver must be selected"
 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
@@ -46,6 +47,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
#12 lore raw

PATCH 3/4 hostapd: make ACS dependent on nl80211

Hello,

Quoted 3 lines · Alexander Mukhin

ACS is supported for nl80211 driver only.

Could you add more details here? Do you see a build failure? Runtime failure?

If CONFIG_ACS=y doesn't build when CONFIG_DRIVER_NL80211 is disabled, then this fix should be part of PATCH 2/4, otherwise PATCH 2/4 introduces a build regression.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#13 lore raw

PATCH 3/4 hostapd: make ACS dependent on nl80211

Hello,

Quoted 8 lines
Quoted 2 lines

ACS is supported for nl80211 driver only.

Could you add more details here? Do you see a build failure? Runtime failure?

If CONFIG_ACS=y doesn't build when CONFIG_DRIVER_NL80211 is disabled, then this fix should be part of PATCH 2/4, otherwise PATCH 2/4 introduces a build regression.

My guide here is hostapd's defconfig, where it's stated that "ACS is currently only supported through the nl80211 driver". Search through the source code also reveals ACS machinery in the nl80211 driver only.

hostapd builds successively with ACS enabled and nl80211 disabled, but an attempt to use ACS by setting a wireless channel to 0 results in a runtime failure (driver doesn't accept this value).

Signature · 2 lines
Best regards,
Alexander.
#14 lore raw

PATCH 3/4 hostapd: make ACS dependent on nl80211

Hello,

Quoted 9 lines · Alexander Mukhin
Quoted 8 lines
Quoted 2 lines

ACS is supported for nl80211 driver only.

Could you add more details here? Do you see a build failure? Runtime failure?

If CONFIG_ACS=y doesn't build when CONFIG_DRIVER_NL80211 is disabled, then this fix should be part of PATCH 2/4, otherwise PATCH 2/4 introduces a build regression.

Quoted 7 lines

My guide here is hostapd's defconfig, where it's stated that "ACS is currently only supported through the nl80211 driver". Search through the source code also reveals ACS machinery in the nl80211 driver only.

hostapd builds successively with ACS enabled and nl80211 disabled, but an attempt to use ACS by setting a wireless channel to 0 results in a runtime failure (driver doesn't accept this value).

Thanks for this additional explanation. Could you include this in the commit log in the next iteration of this patch series ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#15 lore raw

PATCH 3/4 hostapd: make ACS dependent on nl80211

Hello,

Quoted 4 lines · Thomas Petazzoni

Thanks for this additional explanation. Could you include this in the commit log in the next iteration of this patch series ?

Yes, I'll surely do.

Signature · 2 lines
Cheers,
Alexander. 
#16 lore raw

PATCH 4/4 hostapd: drop default netlink dependency

In reply to Alexander Mukhin

Get rid of netlink and threads dependency if the options selected allow so.

---
 package/hostapd/Config.in  | 16 ++++++++++------
 package/hostapd/hostapd.mk | 29 +++++++++++++++++++----------
 2 files changed, 29 insertions(+), 16 deletions(-)
package/hostapd/Config.in +10 -6
index 57cec469c6..115563f564 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.
 
@@ -23,9 +21,14 @@ 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
 	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"
 	help
@@ -83,12 +86,13 @@ 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_TOOLCHAIN_HAS_THREADS
-	depends on BR2_USE_MMU
+
+endif
package/hostapd/hostapd.mk +19 -10
index 143efe9627..9b73c596f8 100644
@@ -11,8 +11,8 @@ 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 =
@@ -23,17 +23,11 @@ HOSTAPD_CONFIG_ENABLE = \
 	CONFIG_IEEE80211N \
 	CONFIG_IEEE80211R \
 	CONFIG_INTERNAL_LIBTOMMATH \
-	CONFIG_INTERWORKING \
-	CONFIG_LIBNL32
+	CONFIG_INTERWORKING
 
 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
+HOSTAPD_USE_NL =
 
 # Try to use openssl if it's already available
 ifeq ($(BR2_PACKAGE_LIBOPENSSL),y)
@@ -51,6 +45,8 @@ endif
 
 ifneq ($(BR2_PACKAGE_HOSTAPD_DRIVER_NL80211),y)
 HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_NL80211
+else
+HOSTAPD_USE_NL = y
 endif
 
 ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_RTW),y)
@@ -89,9 +85,22 @@ HOSTAPD_CONFIG_ENABLE += CONFIG_FULL_DYNAMIC_VLAN
 endif
 
 ifeq ($(BR2_PACKAGE_HOSTAPD_VLAN_NETLINK),y)
+HOSTAPD_USE_NL = y
 HOSTAPD_CONFIG_ENABLE += CONFIG_VLAN_NETLINK
 endif
 
+ifeq ($(HOSTAPD_USE_NL),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
#17 lore raw

PATCH 4/4 hostapd: drop default netlink dependency

Hello,

package/hostapd/hostapd.mk HOSTAPD_CONFIG_ENABLE = \ · line 30

Quoted 7 lines · Alexander Mukhin
package/hostapd/hostapd.mk +1 -6
-# 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
+HOSTAPD_USE_NL =

Instead of this, just use:

ifeq ($(BR2_PACKAGE_LIBNL),y)

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#18 lore raw

cover hostapd: new configuration options

In reply to Alexander Mukhin
Quoted 10 lines

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

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

For the whole patch set:

Regards,
Sergey