diff mbox

[iproute2] libnetlink: reduce size of message sent to kernel

Message ID 1479570613-3104-1-git-send-email-zhangshengju@cmss.chinamobile.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Zhang Shengju Nov. 19, 2016, 3:50 p.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Hemminger Nov. 29, 2016, 9:07 p.m. UTC | #1
On Sat, 19 Nov 2016 23:50:13 +0800
Zhang Shengju <zhangshengju@cmss.chinamobile.com> wrote:

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

Applied, and queued for next push.
Added a Fixes tag since this was introduced by changes to do selective query.
diff mbox

Patch

diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 2279935..d0e19cc 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, (void*)&req, req.nlh.nlmsg_len, 0);
 }
 
 int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,