]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
libnetlink: Process further iovs on no error
authorPetr Machata <petrm@mellanox.com>
Tue, 4 Dec 2018 16:07:41 +0000 (16:07 +0000)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 4 Dec 2018 22:28:31 +0000 (14:28 -0800)
When no error is reported in the first iov, do not prematurely return,
but process further iovs. This fixes batch processing.

Fixes: c60389e4f9ea ("libnetlink: fix leak and using unused memory on error")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
lib/libnetlink.c

index c0b80ed6fdfb839a3e9560de5b52ac1b048f0ab9..954571097ea8dd90a1ec3461da84865a4655f1be 100644 (file)
@@ -763,6 +763,7 @@ static int __rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iov,
        msg.msg_iovlen = 1;
        i = 0;
        while (1) {
+next:
                status = rtnl_recvmsg(rtnl->fd, &msg, &buf);
                ++i;
 
@@ -826,6 +827,8 @@ static int __rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iov,
                                else
                                        free(buf);
 
+                               if (i < iovlen)
+                                       goto next;
                                return error ? -i : 0;
                        }