Skip to content

nl80211 fixes#377

Merged
jow- merged 5 commits intojow-:masterfrom
nbd168:nl80211-fixes
Mar 1, 2026
Merged

nl80211 fixes#377
jow- merged 5 commits intojow-:masterfrom
nbd168:nl80211-fixes

Conversation

@nbd168
Copy link
Contributor

@nbd168 nbd168 commented Feb 27, 2026

A small set of fixes for the nl80211 module

When listener.request() sends a request on the shared event socket,
the receive loop uses a callback set that only knows about request-reply
processing. Multicast events arriving during this window are either
misprocessed as replies, or cause recvmsgs() to abort with a sequence
number mismatch (multicast events carry seq 0), losing any remaining
messages in the same receive buffer.

Fix this by disabling the default sequence check when operating on the
event socket and forwarding multicast events (identified by nlmsg_seq
== 0) from cb_reply to cb_listener_event.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
The poll() call was outside the receive loop, so it only waited for the
first batch of data. If that batch didn't contain the desired command,
the while loop called nl_recvmsgs() repeatedly on the non-blocking
socket, spinning on EAGAIN returns without ever blocking for new data.

Move poll() inside the loop so it blocks between receive batches. Track
elapsed time with CLOCK_MONOTONIC to honor the original timeout across
iterations.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
When multiple messages matching the command filter arrive in a single
receive buffer, cb_event() overwrites s->res without freeing the
previous value.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Only set s->cmd (which terminates the waitfor loop) when
uc_nl_prepare_event() succeeds. Previously a parse failure still set
s->cmd, causing waitfor() to return a match with a null message body.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
@jow- jow- merged commit ec83ea9 into jow-:master Mar 1, 2026
2 checks passed
@jow-
Copy link
Owner

jow- commented Mar 1, 2026

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants