hostapd: drop default dependency on netlink
authorAlexander Mukhin <alexander.i.mukhin@gmail.com>
Sat, 30 Dec 2017 15:57:36 +0000 (18:57 +0300)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Mon, 2 Apr 2018 16:32:07 +0000 (18:32 +0200)
Get rid of netlink dependency if the options selected allow that.

Signed-off-by: Alexander Mukhin <alexander.i.mukhin@gmail.com>
Reviewed-by: Sam Voss <sam.voss@rockwellcollins.com>
[Thomas/Arnout: use a if BR2_PACKAGE_HOSTAPD_VLAN .. endif block.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/hostapd/Config.in
package/hostapd/hostapd.mk

index d23e5e1dca04d04d3c3bfd5831c785d1e5f7e019..37c1126859757b62139bbc3e478428d804c69cc1 100644 (file)
@@ -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
@@ -84,10 +87,11 @@ config BR2_PACKAGE_HOSTAPD_VLAN
        help
          Enable support for VLANs.
 
+if BR2_PACKAGE_HOSTAPD_VLAN
+
 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
@@ -96,13 +100,15 @@ config BR2_PACKAGE_HOSTAPD_VLAN_DYNAMIC
 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 # BR2_PACKAGE_HOSTAPD_VLAN
+
+endif
index f9072784ebec8b9c06cf474e3d6346d805c76032..fa8226805d59c1ac5e85fe1aa5eddb7cc28f975a 100644 (file)
@@ -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)) \