Skip to content

Commit

Permalink
hostapd: adjust patches to work with git am
Browse files Browse the repository at this point in the history
This adds From:, Date: and Subject: to patches, allowing one to run 'git
am' to import the patches to a hostapd git repository.

From: and Date: fields were taken from the OpenWrt commit where the
patches were first introduced.

Most of the Subject: also followed suit, except for:
 - 300-noscan.patch: Took the description from the LuCI web interface
 - 350-nl80211_del_beacon_bss.patch: Used the file name

The order of the files in the patch was changed to match what git
format-patch does.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
  • Loading branch information
cotequeiroz authored and nbd168 committed Apr 4, 2024
1 parent 3f5a9e8 commit 9237908
Show file tree
Hide file tree
Showing 37 changed files with 1,165 additions and 888 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 25 May 2021 10:50:16 +0200
Subject: [PATCH] fix adding back stations after a missed deauth/disassoc

--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4659,6 +4659,13 @@ static int add_associated_sta(struct hos
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
From: David Bauer <mail@david-bauer.net>
Date: Tue, 24 Oct 2023 03:07:48 +0200
Subject: [PATCH] hostapd: fix OWE association with mbedtls

The code for hostapd-mbedtls did not work when used for OWE association.

When handling association requests, the buffer offsets and length assumptions were incorrect, leading to never calculating the y point, thus denying association.
When handling association requests, the buffer offsets and length
assumptions were incorrect, leading to never calculating the y point,
thus denying association.

Also when crafting the association response, the buffer contained the trailing key-type.
Also when crafting the association response, the buffer contained the
trailing key-type.

Fix up both issues to adhere to the specification and make hostapd-mbedtls work with the OWE security type.
Fix up both issues to adhere to the specification and make
hostapd-mbedtls work with the OWE security type.

--- a/src/crypto/crypto_mbedtls.c
+++ b/src/crypto/crypto_mbedtls.c
Expand Down
255 changes: 131 additions & 124 deletions package/network/services/hostapd/patches/200-multicall.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
From: Felix Fietkau <nbd@openwrt.org>
Date: Sat, 23 Jan 2010 08:28:26 +0000
Subject: [PATCH] Add option to build a multicall binary

This allows building both hostapd and wpa_supplicant as a single binary
(wpad).

--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -1,6 +1,7 @@
Expand Down Expand Up @@ -62,6 +69,86 @@
nt_password_hash: $(NOBJS)
$(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
@$(E) " LD " $@
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -705,6 +705,11 @@ fail:
return -1;
}

+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);
+
+void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);

#ifdef CONFIG_WPS
static int gen_uuid(const char *txt_addr)
@@ -798,6 +803,8 @@ int main(int argc, char *argv[])
return -1;
#endif /* CONFIG_DPP */

+ wpa_supplicant_event = hostapd_wpa_event;
+ wpa_supplicant_event_global = hostapd_wpa_event_global;
for (;;) {
c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:q");
if (c < 0)
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -2341,8 +2341,8 @@ err:
#endif /* CONFIG_OWE */


-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
- union wpa_event_data *data)
+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data)
{
struct hostapd_data *hapd = ctx;
struct sta_info *sta;
@@ -2674,7 +2674,7 @@ void wpa_supplicant_event(void *ctx, enu
}


-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
+void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
union wpa_event_data *data)
{
struct hapd_interfaces *interfaces = ctx;
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -6760,8 +6760,8 @@ union wpa_event_data {
* Driver wrapper code should call this function whenever an event is received
* from the driver.
*/
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
- union wpa_event_data *data);
+extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);

/**
* wpa_supplicant_event_global - Report a driver event for wpa_supplicant
@@ -6773,7 +6773,7 @@ void wpa_supplicant_event(void *ctx, enu
* Same as wpa_supplicant_event(), but we search for the interface in
* wpa_global.
*/
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
+extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
union wpa_event_data *data);

/*
--- a/src/drivers/drivers.c
+++ b/src/drivers/drivers.c
@@ -10,6 +10,10 @@
#include "utils/common.h"
#include "driver.h"

+void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);
+void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);

const struct wpa_driver_ops *const wpa_drivers[] =
{
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -10,6 +10,7 @@ ALL += dbus/fi.w1.wpa_supplicant1.servic
Expand Down Expand Up @@ -154,50 +241,63 @@
wpa_supplicant.exe: wpa_supplicant
mv -f $< $@
wpa_cli.exe: wpa_cli
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -6760,8 +6760,8 @@ union wpa_event_data {
* Driver wrapper code should call this function whenever an event is received
* from the driver.
*/
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
- union wpa_event_data *data);
+extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);
--- a/wpa_supplicant/eapol_test.c
+++ b/wpa_supplicant/eapol_test.c
@@ -31,7 +31,12 @@
#include "ctrl_iface.h"
#include "pcsc_funcs.h"
#include "wpas_glue.h"
+#include "drivers/driver.h"

/**
* wpa_supplicant_event_global - Report a driver event for wpa_supplicant
@@ -6773,7 +6773,7 @@ void wpa_supplicant_event(void *ctx, enu
* Same as wpa_supplicant_event(), but we search for the interface in
* wpa_global.
*/
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
+extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
union wpa_event_data *data);
+void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);
+void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);

/*
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -2341,8 +2341,8 @@ err:
#endif /* CONFIG_OWE */
const struct wpa_driver_ops *const wpa_drivers[] = { NULL };

@@ -1325,6 +1330,10 @@ static void usage(void)
"option several times.\n");
}

+extern void supplicant_event(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);
+extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);

int main(int argc, char *argv[])
{
@@ -1348,6 +1357,8 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;

+ wpa_supplicant_event = supplicant_event;
+ wpa_supplicant_event_global = supplicant_event_global;
hostapd_logger_register_cb(hostapd_logger_cb);

os_memset(&eapol_test, 0, sizeof(eapol_test));
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -5919,8 +5919,8 @@ static void wpas_link_reconfig(struct wp
}


-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
- union wpa_event_data *data)
+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data)
+void supplicant_event(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data)
{
struct hostapd_data *hapd = ctx;
struct sta_info *sta;
@@ -2674,7 +2674,7 @@ void wpa_supplicant_event(void *ctx, enu
struct wpa_supplicant *wpa_s = ctx;
int resched;
@@ -6872,7 +6872,7 @@ void wpa_supplicant_event(void *ctx, enu
}


-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
+void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
+void supplicant_event_global(void *ctx, enum wpa_event_type event,
union wpa_event_data *data)
{
struct hapd_interfaces *interfaces = ctx;
struct wpa_supplicant *wpa_s;
--- a/wpa_supplicant/wpa_priv.c
+++ b/wpa_supplicant/wpa_priv.c
@@ -1039,8 +1039,8 @@ static void wpa_priv_send_ft_response(st
Expand Down Expand Up @@ -229,28 +329,6 @@
wpa_priv_fd_workaround();

os_memset(&global, 0, sizeof(global));
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -5919,8 +5919,8 @@ static void wpas_link_reconfig(struct wp
}


-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
- union wpa_event_data *data)
+void supplicant_event(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data)
{
struct wpa_supplicant *wpa_s = ctx;
int resched;
@@ -6872,7 +6872,7 @@ void wpa_supplicant_event(void *ctx, enu
}


-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
+void supplicant_event_global(void *ctx, enum wpa_event_type event,
union wpa_event_data *data)
{
struct wpa_supplicant *wpa_s;
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -7583,7 +7583,6 @@ struct wpa_interface * wpa_supplicant_ma
Expand Down Expand Up @@ -282,74 +360,3 @@

if (params->wpa_debug_file_path)
wpa_debug_open_file(params->wpa_debug_file_path);
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -705,6 +705,11 @@ fail:
return -1;
}

+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);
+
+void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);

#ifdef CONFIG_WPS
static int gen_uuid(const char *txt_addr)
@@ -798,6 +803,8 @@ int main(int argc, char *argv[])
return -1;
#endif /* CONFIG_DPP */

+ wpa_supplicant_event = hostapd_wpa_event;
+ wpa_supplicant_event_global = hostapd_wpa_event_global;
for (;;) {
c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:q");
if (c < 0)
--- a/src/drivers/drivers.c
+++ b/src/drivers/drivers.c
@@ -10,6 +10,10 @@
#include "utils/common.h"
#include "driver.h"

+void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);
+void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);

const struct wpa_driver_ops *const wpa_drivers[] =
{
--- a/wpa_supplicant/eapol_test.c
+++ b/wpa_supplicant/eapol_test.c
@@ -31,7 +31,12 @@
#include "ctrl_iface.h"
#include "pcsc_funcs.h"
#include "wpas_glue.h"
+#include "drivers/driver.h"

+void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);
+void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);

const struct wpa_driver_ops *const wpa_drivers[] = { NULL };

@@ -1325,6 +1330,10 @@ static void usage(void)
"option several times.\n");
}

+extern void supplicant_event(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);
+extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
+ union wpa_event_data *data);

int main(int argc, char *argv[])
{
@@ -1348,6 +1357,8 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;

+ wpa_supplicant_event = supplicant_event;
+ wpa_supplicant_event_global = supplicant_event_global;
hostapd_logger_register_cb(hostapd_logger_cb);

os_memset(&eapol_test, 0, sizeof(eapol_test));
5 changes: 5 additions & 0 deletions package/network/services/hostapd/patches/300-noscan.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
From c61daab867671af884a7bb707f9bc0f086241bcd Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Wed, 20 Jan 2010 02:26:00 +0000
Subject: [PATCH] Add noscan, no_ht_coex config options

--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3656,6 +3656,10 @@ static int hostapd_config_fill(struct ho
Expand Down
27 changes: 16 additions & 11 deletions package/network/services/hostapd/patches/301-mesh-noscan.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
From: Daniel Golle <daniel@makrotopia.org>
Date: Fri, 20 Apr 2018 07:41:03 +0200
Subject: [PATCH] Allow HT40 also on 2.4GHz if noscan option is set, which also
skips secondary channel scan just like noscan works in AP mode.

--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2639,6 +2639,7 @@ static const struct parse_data ssid_fiel
Expand All @@ -18,6 +23,17 @@
INT(mesh_fwding);
INT(frequency);
INT(enable_edmg);
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -1035,6 +1035,8 @@ struct wpa_ssid {
*/
int no_auto_peer;

+ int noscan;
+
/**
* mesh_rssi_threshold - Set mesh parameter mesh_rssi_threshold (dBm)
*
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -506,6 +506,8 @@ static int wpa_supplicant_mesh_init(stru
Expand Down Expand Up @@ -67,14 +83,3 @@
/* Setup higher BW only for 5 GHz */
if (mode->mode == HOSTAPD_MODE_IEEE80211A) {
ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan, dfs_enabled);
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -1035,6 +1035,8 @@ struct wpa_ssid {
*/
int no_auto_peer;

+ int noscan;
+
/**
* mesh_rssi_threshold - Set mesh parameter mesh_rssi_threshold (dBm)
*
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
From 64268c716596edbad395cfa82ff30eb84a2f8488 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Sat, 23 Jan 2010 08:28:26 +0000
Subject: [PATCH] rescan_immediately.patch

--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -5870,7 +5870,7 @@ wpa_supplicant_alloc(struct wpa_supplica
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
From: Felix Fietkau <nbd@openwrt.org>
Date: Thu, 8 Jul 2010 18:36:22 +0000
Subject: [PATCH] hostapd: make rfkill support optional

--- a/src/drivers/drivers.mak
+++ b/src/drivers/drivers.mak
@@ -54,7 +54,6 @@ NEED_SME=y
Expand Down
Loading

0 comments on commit 9237908

Please sign in to comment.