From f350ecc799b3b26badf52719dd0978470ac3624f Mon Sep 17 00:00:00 2001 From: Beginner <70857188+Beginner-Go@users.noreply.github.com> Date: Tue, 31 Aug 2021 01:07:54 +0800 Subject: [PATCH] hostapd: sync upstream (#7771) * hostapd: refresh patches Signed-off-by: David Bauer * hostapd: fix Proxy-ARP with Hotspot 2.0 disabled The disable_dgaf config fiels is only available in case Hostapd is compiled with Hotspot 2.0 support, however Proxy-ARP does not depend on Hotspot 2.0. Only add the code related to this config field when Hotspot 2.0 is enabled to fix compilation with the aformentioned preconditions. Signed-off-by: David Bauer * hostapd: enable proxy-arp support for hostapd-full The hostapd.sh script already has support for configuring proxy-ARP, however no built variant has support for it enabled. Enable proxy-ARP support for hostapd-full builds in order to allow users to actually use this feature. Signed-off-by: David Bauer Co-authored-by: David Bauer --- .../hostapd/files/hostapd-basic.config | 3 ++ .../hostapd/files/hostapd-full.config | 3 ++ .../hostapd/files/hostapd-mini.config | 3 ++ .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/350-nl80211_del_beacon_bss.patch | 10 ++-- ...-use-new-parameters-during-ibss-join.patch | 4 +- .../patches/463-add-mcast_rate-to-11s.patch | 4 +- .../hostapd/patches/700-wifi-reload.patch | 2 +- .../patches/720-iface_max_num_sta.patch | 2 +- ...ompilation-with-Hotspot-2.0-disabled.patch | 51 +++++++++++++++++++ 10 files changed, 72 insertions(+), 12 deletions(-) create mode 100644 package/network/services/hostapd/patches/741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch diff --git a/package/network/services/hostapd/files/hostapd-basic.config b/package/network/services/hostapd/files/hostapd-basic.config index 33c38192b..1f52546d5 100644 --- a/package/network/services/hostapd/files/hostapd-basic.config +++ b/package/network/services/hostapd/files/hostapd-basic.config @@ -386,6 +386,9 @@ CONFIG_TLS=internal # Airtime policy support CONFIG_AIRTIME_POLICY=y +# Proxy ARP support +#CONFIG_PROXYARP=y + # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index df272e443..6d5e90cd4 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -386,6 +386,9 @@ CONFIG_TAXONOMY=y # Airtime policy support CONFIG_AIRTIME_POLICY=y +# Proxy ARP support +CONFIG_PROXYARP=y + # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config index b3050f7bb..f2ed071ec 100644 --- a/package/network/services/hostapd/files/hostapd-mini.config +++ b/package/network/services/hostapd/files/hostapd-mini.config @@ -386,6 +386,9 @@ CONFIG_TLS=internal # Airtime policy support #CONFIG_AIRTIME_POLICY=y +# Proxy ARP support +#CONFIG_PROXYARP=y + # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch index 9ced08801..ca586d862 100644 --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4973,7 +4973,7 @@ static int nl80211_set_channel(struct i8 +@@ -4970,7 +4970,7 @@ static int nl80211_set_channel(struct i8 freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch index 1f9b74e97..656b744aa 100644 --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -2918,10 +2918,15 @@ static int wpa_driver_nl80211_del_beacon +@@ -2915,10 +2915,15 @@ static int wpa_driver_nl80211_del_beacon struct nl_msg *msg; struct wpa_driver_nl80211_data *drv = bss->drv; @@ -18,7 +18,7 @@ return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); } -@@ -5602,7 +5607,7 @@ static void nl80211_teardown_ap(struct i +@@ -5601,7 +5606,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); @@ -27,7 +27,7 @@ } -@@ -8051,8 +8056,6 @@ static int wpa_driver_nl80211_if_remove( +@@ -8048,8 +8053,6 @@ static int wpa_driver_nl80211_if_remove( } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); @@ -36,7 +36,7 @@ nl80211_destroy_bss(bss); if (!bss->added_if) i802_set_iface_flags(bss, 0); -@@ -8449,7 +8452,6 @@ static int wpa_driver_nl80211_deinit_ap( +@@ -8446,7 +8449,6 @@ static int wpa_driver_nl80211_deinit_ap( if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); @@ -44,7 +44,7 @@ /* * If the P2P GO interface was dynamically added, then it is -@@ -8469,7 +8471,6 @@ static int wpa_driver_nl80211_stop_ap(vo +@@ -8466,7 +8468,6 @@ static int wpa_driver_nl80211_stop_ap(vo if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); diff --git a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch index 1d2a053fa..b3c8b2646 100644 --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5951,7 +5951,7 @@ static int wpa_driver_nl80211_ibss(struc +@@ -5950,7 +5950,7 @@ static int wpa_driver_nl80211_ibss(struc struct wpa_driver_associate_params *params) { struct nl_msg *msg; @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli int count = 0; wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); -@@ -5978,6 +5978,37 @@ retry: +@@ -5977,6 +5977,37 @@ retry: nl80211_put_beacon_int(msg, params->beacon_int)) goto fail; diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index 1794befe9..d9a6e7414 100644 --- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -10476,6 +10476,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -10473,6 +10473,18 @@ static int nl80211_put_mesh_id(struct nl } @@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params) { -@@ -10537,6 +10549,7 @@ static int nl80211_join_mesh(struct i802 +@@ -10534,6 +10546,7 @@ static int nl80211_join_mesh(struct i802 nl80211_put_basic_rates(msg, params->basic_rates) || nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || nl80211_put_beacon_int(msg, params->beacon_int) || diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch index 5993b0d44..e51edd7da 100644 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ b/package/network/services/hostapd/patches/700-wifi-reload.patch @@ -175,7 +175,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4820,6 +4820,9 @@ static int wpa_driver_nl80211_set_ap(voi +@@ -4817,6 +4817,9 @@ static int wpa_driver_nl80211_set_ap(voi if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch index b93a0bcbe..e46c1f1a2 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -60,7 +60,7 @@ struct hapd_interfaces *interfaces = iface->interfaces; --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1039,7 +1039,7 @@ void handle_probe_req(struct hostapd_dat +@@ -1042,7 +1042,7 @@ void handle_probe_req(struct hostapd_dat if (hapd->conf->no_probe_resp_if_max_sta && is_multicast_ether_addr(mgmt->da) && is_multicast_ether_addr(mgmt->bssid) && diff --git a/package/network/services/hostapd/patches/741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch b/package/network/services/hostapd/patches/741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch new file mode 100644 index 000000000..657ef5f2e --- /dev/null +++ b/package/network/services/hostapd/patches/741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch @@ -0,0 +1,51 @@ +From ad694836b2ded6b97b426bf331627537cdbff591 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Thu, 19 Aug 2021 00:52:04 +0200 +Subject: [PATCH] proxyarp: fix compilation with Hotspot 2.0 disabled + +The disable_dgaf config fiels is only available in case Hostapd is +compiled with Hotspot 2.0 support, however Proxy-ARP does not depend on +Hotspot 2.0. + +Only add the code related to this config field when Hotspot 2.0 is +enabled to fix compilation with the aformentioned preconditions. + +Signed-off-by: David Bauer +--- + src/ap/dhcp_snoop.c | 2 ++ + src/ap/ndisc_snoop.c | 2 ++ + 2 files changed, 4 insertions(+) + +--- a/src/ap/dhcp_snoop.c ++++ b/src/ap/dhcp_snoop.c +@@ -88,6 +88,7 @@ static void handle_dhcp(void *ctx, const + } + } + ++#ifdef CONFIG_HS20 + if (hapd->conf->disable_dgaf && is_broadcast_ether_addr(buf)) { + for (sta = hapd->sta_list; sta; sta = sta->next) { + if (!(sta->flags & WLAN_STA_AUTHORIZED)) +@@ -96,6 +97,7 @@ static void handle_dhcp(void *ctx, const + (u8 *) buf, len); + } + } ++#endif + + if (msgtype == DHCPACK) { + if (b->your_ip == 0) +--- a/src/ap/ndisc_snoop.c ++++ b/src/ap/ndisc_snoop.c +@@ -151,10 +151,12 @@ static void handle_ndisc(void *ctx, cons + return; + } + break; ++#ifdef CONFIG_HS20 + case ROUTER_ADVERTISEMENT: + if (hapd->conf->disable_dgaf) + ucast_to_stas(hapd, buf, len); + break; ++#endif + case NEIGHBOR_ADVERTISEMENT: + if (hapd->conf->na_mcast_to_ucast) + ucast_to_stas(hapd, buf, len);