From cdac920beb540736200639a6254e6dc01422e705 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Fri, 15 Nov 2019 15:26:31 +0100 Subject: executor: consider NLMSG_DONE type in netlink_send_ext() In case the dump is empty, NLMSG_DONE type message is received from kernel right away. Count with this and return 0. Set the reply_len to 0. Reported-by: Dmitry Vyukov Fixes: f350e2dc1f59 ("executor: rename devlink port netdevices to defined names") Signed-off-by: Jiri Pirko --- pkg/csource/generated.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg/csource') diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 86c03f8d2..987253a5e 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -1224,6 +1224,10 @@ static int netlink_send_ext(struct nlmsg* nlmsg, int sock, if (n != hdr->nlmsg_len) fail("short netlink write: %d/%d", n, hdr->nlmsg_len); n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); + if (hdr->nlmsg_type == NLMSG_DONE) { + *reply_len = 0; + return 0; + } if (n < sizeof(struct nlmsghdr)) fail("short netlink read: %d", n); if (reply_len && hdr->nlmsg_type == reply_type) { -- cgit mrf-deployment