eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 5f4f15a6008b6feb8fe2409d2862609e0c3c6b2d
parent cda7644557a0e8953e903bcdc50709daa269cf43
Author: James Prestwood <prestwoj@gmail.com>
Date:   Wed, 28 Jun 2023 13:20:32 -0700

hwsim: move frame processing into a separate function

The ADD/DEL_MAC_ADDR events come through the unicast handler so
move the frame processing to a separate function so these other
events can be handled.

Diffstat:
Mtools/hwsim.c | 30++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/tools/hwsim.c b/tools/hwsim.c @@ -1572,7 +1572,9 @@ static void process_frame(struct hwsim_frame *frame) hwsim_frame_unref(frame); } -static void unicast_handler(struct l_genl_msg *msg, void *user_data) + + +static void hwsim_frame_event(struct l_genl_msg *msg) { struct hwsim_frame *frame; const struct mmpdu_header *mpdu; @@ -1581,9 +1583,6 @@ static void unicast_handler(struct l_genl_msg *msg, void *user_data) const void *data; const uint8_t *transmitter = NULL, *freq = NULL, *flags = NULL; - if (l_genl_msg_get_command(msg) != HWSIM_CMD_FRAME) - return; - if (!l_genl_attr_init(&attr, msg)) return; @@ -1683,6 +1682,24 @@ static void unicast_handler(struct l_genl_msg *msg, void *user_data) process_frame(frame); } +static void hwsim_unicast_handler(struct l_genl_msg *msg, void *user_data) +{ + uint8_t cmd; + + if (l_genl_msg_get_error(msg) < 0) + return; + + cmd = l_genl_msg_get_command(msg); + + switch (cmd) { + case HWSIM_CMD_FRAME: + hwsim_frame_event(msg); + break; + default: + break; + } +} + static void radio_manager_create_callback(struct l_genl_msg *msg, void *user_data) { @@ -2939,8 +2956,9 @@ static void hwsim_ready(void) } if (!l_genl_add_unicast_watch(genl, "MAC80211_HWSIM", - unicast_handler, NULL, NULL)) { - l_error("Failed to set unicast handler"); + hwsim_unicast_handler, + NULL, NULL)) { + l_error("Failed to set hwsim unicast handler"); goto error; }