]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
libnetlink: reduce size of message sent to kernel
authorZhang Shengju <zhangshengju@cmss.chinamobile.com>
Sat, 19 Nov 2016 15:50:13 +0000 (23:50 +0800)
committerStephen Hemminger <sthemmin@microsoft.com>
Tue, 29 Nov 2016 21:03:00 +0000 (13:03 -0800)
Fixes commit 246f57c4086d99fa ("ip link: Add support for kernel
side filtering").

This patch reduce the size of message sent to kernel space. Before this
patch, for command: 'ip link show', we will sent 1056 bytes. With this
patch, we only need to send 40 bytes.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
lib/libnetlink.c

index 22799355ed7a7b8309200388d97df43568077ac8..7f2a0d447a22a2d9ca7850fa8f46a7e23b1d26a2 100644 (file)
@@ -149,7 +149,7 @@ int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int family, int type,
        if (err)
                return err;
 
-       return send(rth->fd, (void*)&req, sizeof(req), 0);
+       return send(rth->fd, &req, req.nlh.nlmsg_len, 0);
 }
 
 int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,