diff --git a/br-ext-chip-hisilicon/Config.in b/br-ext-chip-hisilicon/Config.in index ec45771c..6be9e5a0 100644 --- a/br-ext-chip-hisilicon/Config.in +++ b/br-ext-chip-hisilicon/Config.in @@ -33,6 +33,8 @@ source "$BR2_EXTERNAL_HISILICON_PATH/package/motors/Config.in" source "$BR2_EXTERNAL_HISILICON_PATH/package/mt7601u-ap-openipc/Config.in" source "$BR2_EXTERNAL_HISILICON_PATH/package/node-exporter/Config.in" source "$BR2_EXTERNAL_HISILICON_PATH/package/opus-openipc/Config.in" +source "$BR2_EXTERNAL_HISILICON_PATH/package/rtl8188eus-openipc/Config.in" +source "$BR2_EXTERNAL_HISILICON_PATH/package/rtw-hostapd/Config.in" source "$BR2_EXTERNAL_HISILICON_PATH/package/rtl8188fu-openipc/Config.in" source "$BR2_EXTERNAL_HISILICON_PATH/package/uacme-openipc/Config.in" source "$BR2_EXTERNAL_HISILICON_PATH/package/vtund-openipc/Config.in" diff --git a/br-ext-chip-hisilicon/external.mk b/br-ext-chip-hisilicon/external.mk index 3b3dc408..87088d81 100644 --- a/br-ext-chip-hisilicon/external.mk +++ b/br-ext-chip-hisilicon/external.mk @@ -33,6 +33,8 @@ include $(BR2_EXTERNAL_HISILICON_PATH)/package/motors/motors.mk include $(BR2_EXTERNAL_HISILICON_PATH)/package/mt7601u-ap-openipc/mt7601u-ap-openipc.mk include $(BR2_EXTERNAL_HISILICON_PATH)/package/node-exporter/node-exporter.mk include $(BR2_EXTERNAL_HISILICON_PATH)/package/opus-openipc/opus-openipc.mk +include $(BR2_EXTERNAL_HISILICON_PATH)/package/rtl8188eus-openipc/rtl8188eus-openipc.mk +include $(BR2_EXTERNAL_HISILICON_PATH)/package/rtw-hostapd/rtw-hostapd.mk include $(BR2_EXTERNAL_HISILICON_PATH)/package/rtl8188fu-openipc/rtl8188fu-openipc.mk include $(BR2_EXTERNAL_HISILICON_PATH)/package/uacme-openipc/uacme-openipc.mk include $(BR2_EXTERNAL_HISILICON_PATH)/package/vtund-openipc/vtund-openipc.mk diff --git a/br-ext-chip-hisilicon/package/rtl8188eus-openipc b/br-ext-chip-hisilicon/package/rtl8188eus-openipc new file mode 120000 index 00000000..29ff6081 --- /dev/null +++ b/br-ext-chip-hisilicon/package/rtl8188eus-openipc @@ -0,0 +1 @@ +../../general/package/rtl8188eus-openipc/ \ No newline at end of file diff --git a/br-ext-chip-hisilicon/package/rtw-hostapd b/br-ext-chip-hisilicon/package/rtw-hostapd new file mode 120000 index 00000000..1d02e651 --- /dev/null +++ b/br-ext-chip-hisilicon/package/rtw-hostapd @@ -0,0 +1 @@ +../../general/package/rtw-hostapd \ No newline at end of file diff --git a/general/package/rtl8188eus-openipc/000-apmode.patch b/general/package/rtl8188eus-openipc/000-apmode.patch new file mode 100644 index 00000000..ee31342b --- /dev/null +++ b/general/package/rtl8188eus-openipc/000-apmode.patch @@ -0,0 +1,10 @@ +--- a/Makefile 2021-05-04 14:44:59.000000000 +0300 ++++ b/Makefile 2021-12-18 12:07:01.433235328 +0200 +@@ -2055,6 +2056,7 @@ + else + + export CONFIG_RTL8188EU = m ++EXTRA_CFLAGS += -DCONFIG_AP_MODE -DCONFIG_RTW_HOSTAPD_ACS -DCONFIG_RTW_MESH + + all: modules + diff --git a/general/package/rtl8188eus-openipc/Config.in b/general/package/rtl8188eus-openipc/Config.in new file mode 100644 index 00000000..af9fc91e --- /dev/null +++ b/general/package/rtl8188eus-openipc/Config.in @@ -0,0 +1,16 @@ +config BR2_PACKAGE_RTL8188EUS_OPENIPC + bool "rtl8188eus-openipc" + depends on BR2_LINUX_KERNEL + help + A standalone driver for the RTL8188EU/RTL8188EUS/RTL8188ETV USB Wi-Fi adapter. + + Make sure your target kernel has the CONFIG_WIRELESS_EXT + config option enabled. + + Note: this package needs a firmware loading mechanism to load + the binary blob for the chip to work. + + https://github.com/aircrack-ng/rtl8188eus/ + +comment "rtl8188eus needs a Linux kernel to be built" + depends on !BR2_LINUX_KERNEL diff --git a/general/package/rtl8188eus-openipc/rtl8188eus-openipc.mk b/general/package/rtl8188eus-openipc/rtl8188eus-openipc.mk new file mode 100644 index 00000000..d70d77ce --- /dev/null +++ b/general/package/rtl8188eus-openipc/rtl8188eus-openipc.mk @@ -0,0 +1,20 @@ +################################################################################ +# +# rtl8188eu +# +################################################################################ + +RTL8188EUS_OPENIPC_VERSION = 6146193406b62e942d13d4d43580ed94ac70c218 +RTL8188EUS_OPENIPC_SITE = $(call github,aircrack-ng,rtl8188eus,$(RTL8188EUS_OPENIPC_VERSION)) +RTL8188EUS_OPENIPC_LICENSE = GPL-2.0, proprietary (rtl8188fufw.bin firmware blob) +RTL8188EUS_OPENIPC_LICENSE_FILES = COPYING +RTL8188EUS_OPENIPC_MODULE_MAKE_OPTS = CONFIG_RTL8188EU=m CONFIG_CALIBRATE_TX_POWER_TO_MAX=y + +define RTL8188EUS_OPENIPC_INSTALL_FIRMWARE + $(INSTALL) -D -m 644 ../general/package/rtl8188eus-openipc/rtl8188fufw.bin \ + $(TARGET_DIR)/lib/firmware/rtlwifi/rtl8188fufw.bin +endef +RTL8188EUS_OPENIPC_POST_INSTALL_TARGET_HOOKS += RTL8188EUS_OPENIPC_INSTALL_FIRMWARE + +$(eval $(kernel-module)) +$(eval $(generic-package)) diff --git a/general/package/rtl8188eus-openipc/rtl8188fufw.bin b/general/package/rtl8188eus-openipc/rtl8188fufw.bin new file mode 100644 index 00000000..0d7fbab5 Binary files /dev/null and b/general/package/rtl8188eus-openipc/rtl8188fufw.bin differ diff --git a/general/package/rtw-hostapd/0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch b/general/package/rtw-hostapd/0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch new file mode 100644 index 00000000..1b26b8de --- /dev/null +++ b/general/package/rtw-hostapd/0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch @@ -0,0 +1,150 @@ +From 5b78c8f961f25f4dc22d6f2b77ddd06d712cec63 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Wed, 3 Jun 2020 23:17:35 +0300 +Subject: [PATCH 1/3] WPS UPnP: Do not allow event subscriptions with URLs to + other networks + +The UPnP Device Architecture 2.0 specification errata ("UDA errata +16-04-2020.docx") addresses a problem with notifications being allowed +to go out to other domains by disallowing such cases. Do such filtering +for the notification callback URLs to avoid undesired connections to +external networks based on subscriptions that any device in the local +network could request when WPS support for external registrars is +enabled (the upnp_iface parameter in hostapd configuration). + +Signed-off-by: Jouni Malinen +--- + src/wps/wps_er.c | 2 +- + src/wps/wps_upnp.c | 38 ++++++++++++++++++++++++++++++++++++-- + src/wps/wps_upnp_i.h | 3 ++- + 3 files changed, 39 insertions(+), 4 deletions(-) + +diff --git a/src/wps/wps_er.c b/src/wps/wps_er.c +index 6bded14327f8..31d2e50e4cff 100644 +--- a/hostapd-2.9/src/wps/wps_er.c ++++ b/hostapd-2.9/src/wps/wps_er.c +@@ -1298,7 +1298,7 @@ wps_er_init(struct wps_context *wps, const char *ifname, const char *filter) + "with %s", filter); + } + if (get_netif_info(er->ifname, &er->ip_addr, &er->ip_addr_text, +- er->mac_addr)) { ++ NULL, er->mac_addr)) { + wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address " + "for %s. Does it have IP address?", er->ifname); + wps_er_deinit(er, NULL, NULL); +diff --git a/src/wps/wps_upnp.c b/src/wps/wps_upnp.c +index 6e10e4bc0c3f..7d4b7439940e 100644 +--- a/hostapd-2.9/src/wps/wps_upnp.c ++++ b/hostapd-2.9/src/wps/wps_upnp.c +@@ -303,6 +303,14 @@ static void subscr_addr_free_all(struct subscription *s) + } + + ++static int local_network_addr(struct upnp_wps_device_sm *sm, ++ struct sockaddr_in *addr) ++{ ++ return (addr->sin_addr.s_addr & sm->netmask.s_addr) == ++ (sm->ip_addr & sm->netmask.s_addr); ++} ++ ++ + /* subscr_addr_add_url -- add address(es) for one url to subscription */ + static void subscr_addr_add_url(struct subscription *s, const char *url, + size_t url_len) +@@ -381,6 +389,7 @@ static void subscr_addr_add_url(struct subscription *s, const char *url, + + for (rp = result; rp; rp = rp->ai_next) { + struct subscr_addr *a; ++ struct sockaddr_in *addr = (struct sockaddr_in *) rp->ai_addr; + + /* Limit no. of address to avoid denial of service attack */ + if (dl_list_len(&s->addr_list) >= MAX_ADDR_PER_SUBSCRIPTION) { +@@ -389,6 +398,13 @@ static void subscr_addr_add_url(struct subscription *s, const char *url, + break; + } + ++ if (!local_network_addr(s->sm, addr)) { ++ wpa_printf(MSG_INFO, ++ "WPS UPnP: Ignore a delivery URL that points to another network %s", ++ inet_ntoa(addr->sin_addr)); ++ continue; ++ } ++ + a = os_zalloc(sizeof(*a) + alloc_len); + if (a == NULL) + break; +@@ -890,11 +906,12 @@ static int eth_get(const char *device, u8 ea[ETH_ALEN]) + * @net_if: Selected network interface name + * @ip_addr: Buffer for returning IP address in network byte order + * @ip_addr_text: Buffer for returning a pointer to allocated IP address text ++ * @netmask: Buffer for returning netmask or %NULL if not needed + * @mac: Buffer for returning MAC address + * Returns: 0 on success, -1 on failure + */ + int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text, +- u8 mac[ETH_ALEN]) ++ struct in_addr *netmask, u8 mac[ETH_ALEN]) + { + struct ifreq req; + int sock = -1; +@@ -920,6 +937,19 @@ int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text, + in_addr.s_addr = *ip_addr; + os_snprintf(*ip_addr_text, 16, "%s", inet_ntoa(in_addr)); + ++ if (netmask) { ++ os_memset(&req, 0, sizeof(req)); ++ os_strlcpy(req.ifr_name, net_if, sizeof(req.ifr_name)); ++ if (ioctl(sock, SIOCGIFNETMASK, &req) < 0) { ++ wpa_printf(MSG_ERROR, ++ "WPS UPnP: SIOCGIFNETMASK failed: %d (%s)", ++ errno, strerror(errno)); ++ goto fail; ++ } ++ addr = (struct sockaddr_in *) &req.ifr_netmask; ++ netmask->s_addr = addr->sin_addr.s_addr; ++ } ++ + #ifdef __linux__ + os_strlcpy(req.ifr_name, net_if, sizeof(req.ifr_name)); + if (ioctl(sock, SIOCGIFHWADDR, &req) < 0) { +@@ -1026,11 +1056,15 @@ static int upnp_wps_device_start(struct upnp_wps_device_sm *sm, char *net_if) + + /* Determine which IP and mac address we're using */ + if (get_netif_info(net_if, &sm->ip_addr, &sm->ip_addr_text, +- sm->mac_addr)) { ++ &sm->netmask, sm->mac_addr)) { + wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address " + "for %s. Does it have IP address?", net_if); + goto fail; + } ++ wpa_printf(MSG_DEBUG, "WPS UPnP: Local IP address %s netmask %s hwaddr " ++ MACSTR, ++ sm->ip_addr_text, inet_ntoa(sm->netmask), ++ MAC2STR(sm->mac_addr)); + + /* Listen for incoming TCP connections so that others + * can fetch our "xml files" from us. +diff --git a/src/wps/wps_upnp_i.h b/src/wps/wps_upnp_i.h +index e87a93232df1..6ead7b4e9a30 100644 +--- a/hostapd-2.9/src/wps/wps_upnp_i.h ++++ b/hostapd-2.9/src/wps/wps_upnp_i.h +@@ -128,6 +128,7 @@ struct upnp_wps_device_sm { + u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */ + char *ip_addr_text; /* IP address of network i.f. we use */ + unsigned ip_addr; /* IP address of network i.f. we use (host order) */ ++ struct in_addr netmask; + int multicast_sd; /* send multicast messages over this socket */ + int ssdp_sd; /* receive discovery UPD packets on socket */ + int ssdp_sd_registered; /* nonzero if we must unregister */ +@@ -158,7 +159,7 @@ struct subscription * subscription_find(struct upnp_wps_device_sm *sm, + const u8 uuid[UUID_LEN]); + void subscr_addr_delete(struct subscr_addr *a); + int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text, +- u8 mac[ETH_ALEN]); ++ struct in_addr *netmask, u8 mac[ETH_ALEN]); + + /* wps_upnp_ssdp.c */ + void msearchreply_state_machine_stop(struct advertisement_state_machine *a); +-- +2.20.1 + diff --git a/general/package/rtw-hostapd/0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch b/general/package/rtw-hostapd/0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch new file mode 100644 index 00000000..7748de7c --- /dev/null +++ b/general/package/rtw-hostapd/0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch @@ -0,0 +1,59 @@ +From f7d268864a2660b7239b9a8ff5ad37faeeb751ba Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Wed, 3 Jun 2020 22:41:02 +0300 +Subject: [PATCH 2/3] WPS UPnP: Fix event message generation using a long URL + path + +More than about 700 character URL ended up overflowing the wpabuf used +for building the event notification and this resulted in the wpabuf +buffer overflow checks terminating the hostapd process. Fix this by +allocating the buffer to be large enough to contain the full URL path. +However, since that around 700 character limit has been the practical +limit for more than ten years, start explicitly enforcing that as the +limit or the callback URLs since any longer ones had not worked before +and there is no need to enable them now either. + +Signed-off-by: Jouni Malinen +--- + src/wps/wps_upnp.c | 9 +++++++-- + src/wps/wps_upnp_event.c | 3 ++- + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/src/wps/wps_upnp.c b/src/wps/wps_upnp.c +index 7d4b7439940e..ab685d52ecab 100644 +--- a/hostapd-2.9/src/wps/wps_upnp.c ++++ b/hostapd-2.9/src/wps/wps_upnp.c +@@ -328,9 +328,14 @@ static void subscr_addr_add_url(struct subscription *s, const char *url, + int rerr; + size_t host_len, path_len; + +- /* url MUST begin with http: */ +- if (url_len < 7 || os_strncasecmp(url, "http://", 7)) ++ /* URL MUST begin with HTTP scheme. In addition, limit the length of ++ * the URL to 700 characters which is around the limit that was ++ * implicitly enforced for more than 10 years due to a bug in ++ * generating the event messages. */ ++ if (url_len < 7 || os_strncasecmp(url, "http://", 7) || url_len > 700) { ++ wpa_printf(MSG_DEBUG, "WPS UPnP: Reject an unacceptable URL"); + goto fail; ++ } + url += 7; + url_len -= 7; + +diff --git a/src/wps/wps_upnp_event.c b/src/wps/wps_upnp_event.c +index d7e6edcc6503..08a23612f338 100644 +--- a/hostapd-2.9/src/wps/wps_upnp_event.c ++++ b/hostapd-2.9/src/wps/wps_upnp_event.c +@@ -147,7 +147,8 @@ static struct wpabuf * event_build_message(struct wps_event_ *e) + struct wpabuf *buf; + char *b; + +- buf = wpabuf_alloc(1000 + wpabuf_len(e->data)); ++ buf = wpabuf_alloc(1000 + os_strlen(e->addr->path) + ++ wpabuf_len(e->data)); + if (buf == NULL) + return NULL; + wpabuf_printf(buf, "NOTIFY %s HTTP/1.1\r\n", e->addr->path); +-- +2.20.1 + diff --git a/general/package/rtw-hostapd/0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch b/general/package/rtw-hostapd/0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch new file mode 100644 index 00000000..42f673f6 --- /dev/null +++ b/general/package/rtw-hostapd/0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch @@ -0,0 +1,47 @@ +From 85aac526af8612c21b3117dadc8ef5944985b476 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Thu, 4 Jun 2020 21:24:04 +0300 +Subject: [PATCH 3/3] WPS UPnP: Handle HTTP initiation failures for events more + properly + +While it is appropriate to try to retransmit the event to another +callback URL on a failure to initiate the HTTP client connection, there +is no point in trying the exact same operation multiple times in a row. +Replve the event_retry() calls with event_addr_failure() for these cases +to avoid busy loops trying to repeat the same failing operation. + +These potential busy loops would go through eloop callbacks, so the +process is not completely stuck on handling them, but unnecessary CPU +would be used to process the continues retries that will keep failing +for the same reason. + +Signed-off-by: Jouni Malinen +--- + src/wps/wps_upnp_event.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/wps/wps_upnp_event.c b/src/wps/wps_upnp_event.c +index 08a23612f338..c0d9e41d9a38 100644 +--- a/hostapd-2.9/src/wps/wps_upnp_event.c ++++ b/hostapd-2.9/src/wps/wps_upnp_event.c +@@ -294,7 +294,7 @@ static int event_send_start(struct subscription *s) + + buf = event_build_message(e); + if (buf == NULL) { +- event_retry(e, 0); ++ event_addr_failure(e); + return -1; + } + +@@ -302,7 +302,7 @@ static int event_send_start(struct subscription *s) + event_http_cb, e); + if (e->http_event == NULL) { + wpabuf_free(buf); +- event_retry(e, 0); ++ event_addr_failure(e); + return -1; + } + +-- +2.20.1 + diff --git a/general/package/rtw-hostapd/0004-Defconfig.patch b/general/package/rtw-hostapd/0004-Defconfig.patch new file mode 100644 index 00000000..896d7181 --- /dev/null +++ b/general/package/rtw-hostapd/0004-Defconfig.patch @@ -0,0 +1,12 @@ +--- a/hostapd-2.9/hostapd/defconfig 2021-10-29 04:23:27.000000000 +0300 ++++ b/hostapd-2.9/hostapd/defconfig 2021-12-17 23:47:31.733934121 +0200 +@@ -15,6 +15,9 @@ + # Driver interface for wired authenticator + #CONFIG_DRIVER_WIRED=y + ++# Driver interface for Realtek WLAN ++CONFIG_DRIVER_RTW=y ++ + # Driver interface for drivers using the nl80211 kernel interface + CONFIG_DRIVER_NL80211=y + diff --git a/general/package/rtw-hostapd/Config.in b/general/package/rtw-hostapd/Config.in new file mode 100644 index 00000000..dd37ba43 --- /dev/null +++ b/general/package/rtw-hostapd/Config.in @@ -0,0 +1,113 @@ +config BR2_PACKAGE_RTW_HOSTAPD + bool "hostapd for Realtek" + depends on BR2_USE_MMU # fork() + help + User space daemon for wireless access points on RTL8xxx. + + It implements IEEE 802.11 access point management, + IEEE 802.1X/WPA/WPA2/EAP authenticators, RADIUS client, + EAP server and RADIUS authentication server. + + http://w1.fi/hostapd/ + +if BR2_PACKAGE_RTW_HOSTAPD + +config BR2_PACKAGE_RTW_HOSTAPD_DRIVER_HOSTAP + bool "Enable hostap driver" + default y + select BR2_PACKAGE_RTW_HOSTAPD_HAS_WIFI_DRIVERS + help + Enable support for Host AP driver. + +config BR2_PACKAGE_RTW_HOSTAPD_DRIVER_NL80211 + bool "Enable nl80211 driver" + default y + depends on BR2_TOOLCHAIN_HAS_THREADS # libnl + select BR2_PACKAGE_LIBNL + select BR2_PACKAGE_RTW_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_RTW_HOSTAPD_DRIVER_RTW + bool "Enable rtw driver" + default y + depends on BR2_TOOLCHAIN_HAS_THREADS # libnl + select BR2_PACKAGE_LIBNL + select BR2_PACKAGE_RTW_HOSTAPD_HAS_WIFI_DRIVERS + help + Enable support for drivers using the Realtek proprietary interface. + +comment "rtw driver needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS + +config BR2_PACKAGE_RTW_HOSTAPD_DRIVER_WIRED + bool "Enable wired driver" + help + Enable support for wired authenticator. + +config BR2_PACKAGE_RTW_HOSTAPD_DRIVER_NONE + bool + default y + depends on !BR2_PACKAGE_RTW_HOSTAPD_DRIVER_HOSTAP + depends on !BR2_PACKAGE_RTW_HOSTAPD_DRIVER_NL80211 + depends on !BR2_PACKAGE_RTW_HOSTAPD_DRIVER_RTW + depends on !BR2_PACKAGE_RTW_HOSTAPD_DRIVER_WIRED + +config BR2_PACKAGE_RTW_HOSTAPD_HAS_WIFI_DRIVERS + bool + +config BR2_PACKAGE_RTW_HOSTAPD_EAP + bool "Enable EAP" + depends on !BR2_STATIC_LIBS + help + Enable support for EAP and RADIUS. + +comment "hostapd EAP needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBS + +config BR2_PACKAGE_RTW_HOSTAPD_WPS + bool "Enable WPS" + help + Enable support for Wi-Fi Protected Setup. + +config BR2_PACKAGE_RTW_HOSTAPD_WPA3 + bool "Enable WPA3 support" + select BR2_PACKAGE_OPENSSL + select BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL + help + Enable WPA3 support including OWE, SAE, DPP + +config BR2_PACKAGE_RTW_HOSTAPD_VLAN + bool "Enable VLAN support" + default y + help + Enable support for VLANs. + +if BR2_PACKAGE_HOSTAPD_VLAN + +config BR2_PACKAGE_RTW_HOSTAPD_VLAN_DYNAMIC + bool "Enable dynamic VLAN support" + default y + help + Enable support for fully dynamic VLANs. + This enables hostapd to automatically create + bridge and VLAN interfaces if necessary. + +config BR2_PACKAGE_RTW_HOSTAPD_VLAN_NETLINK + bool "Use netlink-based API for VLAN operations" + default y + depends on BR2_TOOLCHAIN_HAS_THREADS # libnl + select BR2_PACKAGE_LIBNL + help + Use netlink-based kernel API for VLAN operations + instead of ioctl(). + +comment "netlink-based VLAN support needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS + +endif # BR2_PACKAGE_RTW_HOSTAPD_VLAN + +endif diff --git a/general/package/rtw-hostapd/rtw-hostapd.mk b/general/package/rtw-hostapd/rtw-hostapd.mk new file mode 100644 index 00000000..2586572b --- /dev/null +++ b/general/package/rtw-hostapd/rtw-hostapd.mk @@ -0,0 +1,158 @@ +################################################################################ +# +# hostapd +# +################################################################################ + +RTW_HOSTAPD_VERSION = a69d6361ef0185aa7d2e4c774bc2de36fe83d81e +RTW_HOSTAPD_SITE = $(call github,lwfinger,rtl8188eu,$(RTW_HOSTAPD_VERSION)) +RTW_HOSTAPD_SUBDIR = hostapd-2.9/hostapd +RTW_HOSTAPD_CONFIG = $(RTW_HOSTAPD_DIR)/$(RTW_HOSTAPD_SUBDIR)/.config +#RTW_HOSTAPD_PATCH = \ +# https://w1.fi/security/2020-1/0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch \ +# https://w1.fi/security/2020-1/0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch \ +# https://w1.fi/security/2020-1/0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch +RTW_HOSTAPD_DEPENDENCIES = host-pkgconf +RTW_HOSTAPD_CFLAGS = $(TARGET_CFLAGS) +RTW_HOSTAPD_LICENSE = BSD-3-Clause +RTW_HOSTAPD_LICENSE_FILES = README + +# 0001-AP-Silently-ignore-management-frame-from-unexpected-.patch +RTW_HOSTAPD_IGNORE_CVES += CVE-2019-16275 + +# 0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch +RTW_HOSTAPD_IGNORE_CVES += CVE-2020-12695 + +RTW_HOSTAPD_CONFIG_SET = + +RTW_HOSTAPD_CONFIG_ENABLE = \ + CONFIG_INTERNAL_LIBTOMMATH \ + CONFIG_DEBUG_FILE \ + CONFIG_DEBUG_SYSLOG + +RTW_HOSTAPD_CONFIG_DISABLE = + +# Try to use openssl if it's already available +ifeq ($(BR2_PACKAGE_LIBOPENSSL),y) +RTW_HOSTAPD_DEPENDENCIES += host-pkgconf libopenssl +RTW_HOSTAPD_LIBS += `$(PKG_CONFIG_HOST_BINARY) --libs openssl` +RTW_HOSTAPD_CONFIG_EDITS += 's/\#\(CONFIG_TLS=openssl\)/\1/' +else +RTW_HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD CONFIG_EAP_TEAP +RTW_HOSTAPD_CONFIG_EDITS += 's/\#\(CONFIG_TLS=\).*/\1internal/' +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_DRIVER_HOSTAP),) +RTW_HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_HOSTAP +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_DRIVER_NL80211),y) +RTW_HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_NL80211 +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_DRIVER_RTW),) +RTW_HOSTAPD_CONFIG_DISABLE += CONFIG_DRIVER_RTW +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_DRIVER_WIRED),y) +RTW_HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_WIRED +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_DRIVER_NONE),y) +RTW_HOSTAPD_CONFIG_ENABLE += CONFIG_DRIVER_NONE +endif + +# Add options for wireless drivers +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_HAS_WIFI_DRIVERS),y) +RTW_HOSTAPD_CONFIG_ENABLE += \ + CONFIG_HS20 \ + CONFIG_IEEE80211AC \ + CONFIG_IEEE80211N \ + CONFIG_IEEE80211R \ + CONFIG_INTERWORKING +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_ACS),y) +RTW_HOSTAPD_CONFIG_ENABLE += CONFIG_ACS +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_EAP),y) +RTW_HOSTAPD_CONFIG_ENABLE += \ + CONFIG_EAP \ + CONFIG_RADIUS_SERVER + +# Enable both TLS v1.1 (CONFIG_TLSV11) and v1.2 (CONFIG_TLSV12) +RTW_HOSTAPD_CONFIG_ENABLE += CONFIG_TLSV1 +else +RTW_HOSTAPD_CONFIG_DISABLE += CONFIG_EAP +RTW_HOSTAPD_CONFIG_ENABLE += \ + CONFIG_NO_ACCOUNTING \ + CONFIG_NO_RADIUS +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_WPS),y) +RTW_HOSTAPD_CONFIG_ENABLE += CONFIG_WPS +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_WPA3),y) +RTW_HOSTAPD_CONFIG_SET += \ + CONFIG_DPP \ + CONFIG_SAE +RTW_HOSTAPD_CONFIG_ENABLE += \ + CONFIG_OWE +else +RTW_HOSTAPD_CONFIG_DISABLE += \ + CONFIG_OWE +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_VLAN),) +RTW_HOSTAPD_CONFIG_ENABLE += CONFIG_NO_VLAN +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_VLAN_DYNAMIC),y) +RTW_HOSTAPD_CONFIG_ENABLE += CONFIG_FULL_DYNAMIC_VLAN +RTW_HOSTAPD_CONFIG_SET += NEED_LINUX_IOCTL +endif + +ifeq ($(BR2_PACKAGE_RTW_HOSTAPD_VLAN_NETLINK),y) +RTW_HOSTAPD_CONFIG_ENABLE += CONFIG_VLAN_NETLINK +endif + +# Options for building with libnl +ifeq ($(BR2_PACKAGE_LIBNL),y) +RTW_HOSTAPD_DEPENDENCIES += libnl +RTW_HOSTAPD_CFLAGS += -I$(STAGING_DIR)/usr/include/libnl3/ +RTW_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) +RTW_HOSTAPD_LIBS += -lnl-3 -lm -lpthread +endif +endif + +define RTW_HOSTAPD_CONFIGURE_CMDS + cp $(@D)/$(RTW_HOSTAPD_SUBDIR)/defconfig $(RTW_HOSTAPD_CONFIG) + sed -i $(patsubst %,-e 's/^#\(%\)/\1/',$(RTW_HOSTAPD_CONFIG_ENABLE)) \ + $(patsubst %,-e 's/^\(%\)/#\1/',$(RTW_HOSTAPD_CONFIG_DISABLE)) \ + $(patsubst %,-e '1i%=y',$(RTW_HOSTAPD_CONFIG_SET)) \ + $(patsubst %,-e %,$(RTW_HOSTAPD_CONFIG_EDITS)) \ + $(RTW_HOSTAPD_CONFIG) +endef + +define RTW_HOSTAPD_BUILD_CMDS + $(MAKE) -C $(@D)/$(RTW_HOSTAPD_SUBDIR) clean + $(TARGET_MAKE_ENV) CFLAGS="$(RTW_HOSTAPD_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" LIBS="$(RTW_HOSTAPD_LIBS)" \ + $(MAKE) CC="$(TARGET_CC)" -C $(@D)/$(RTW_HOSTAPD_SUBDIR) +endef + +define RTW_HOSTAPD_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/$(RTW_HOSTAPD_SUBDIR)/hostapd \ + $(TARGET_DIR)/usr/sbin/hostapd + $(INSTALL) -m 0755 -D $(@D)/$(RTW_HOSTAPD_SUBDIR)/hostapd_cli \ + $(TARGET_DIR)/usr/bin/hostapd_cli + $(INSTALL) -m 0644 -D $(@D)/$(RTW_HOSTAPD_SUBDIR)/hostapd.conf \ + $(TARGET_DIR)/etc/hostapd.conf +endef +$(eval $(generic-package))