b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven@narfation.org>
Subject: [PATCH 1/6] batctl: Consume genl ACKs after setting reads
Date: Mon, 10 May 2021 21:49:40 +0200	[thread overview]
Message-ID: <20210510194945.103735-2-sven@narfation.org> (raw)
In-Reply-To: <20210510194945.103735-1-sven@narfation.org>

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);
-	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;

  reply	other threads:[~2021-05-10 19:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 19:49 [PATCH 0/6] batctl: Use shared batadv genl socket for requests Sven Eckelmann
2021-05-10 19:49 ` Sven Eckelmann [this message]
2021-05-10 19:49 ` [PATCH 2/6] batctl: throughputmeter: Use global genl socket Sven Eckelmann
2021-05-10 19:49 ` [PATCH 3/6] batctl: interface: List using shared " Sven Eckelmann
2021-05-10 19:49 ` [PATCH 4/6] batctl: Get meshif info " Sven Eckelmann
2021-05-10 19:49 ` [PATCH 5/6] batctl: Use common genl socket for netlink_query_common Sven Eckelmann
2021-05-10 19:49 ` [PATCH 6/6] batctl: routing_algo: List using shared genl socket Sven Eckelmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210510194945.103735-2-sven@narfation.org \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).