From 1b109a30bf711833da0f674e46da8aaafa6a9e4f Mon Sep 17 00:00:00 2001 From: Zhang Shengju Date: Sat, 19 Nov 2016 23:50:13 +0800 Subject: [PATCH] libnetlink: reduce size of message sent to kernel 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 --- lib/libnetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libnetlink.c b/lib/libnetlink.c index 22799355..7f2a0d44 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -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,