The kernel is sending an ACK after an successful read request via the batadv genl socket. This ack must be consumed manually after the actual message was processed. Otherwise, the next user of the socket can get confused by the unexpected ACK in the socket queue.
Signed-off-by: Sven Eckelmann sven@narfation.org --- sys.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sys.c b/sys.c index 6dd8c10..f1dc275 100644 --- a/sys.c +++ b/sys.c @@ -107,7 +107,13 @@ int sys_simple_nlquery(struct state *state, enum batadv_nl_commands nl_cmd, nl_send_auto_complete(state->sock, msg); nlmsg_free(msg);
- nl_recvmsgs(state->sock, state->cb); + if (callback) { + ret = nl_recvmsgs(state->sock, state->cb); + if (ret < 0) + return ret; + } + + nl_wait_for_ack(state->sock);
return result; }