netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iproute2] libnetlink: reduce size of message sent to kernel
@ 2016-11-19 15:50 Zhang Shengju
  2016-11-29 21:07 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Shengju @ 2016-11-19 15:50 UTC (permalink / raw)
  To: netdev

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

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [iproute2] libnetlink: reduce size of message sent to kernel
  2016-11-19 15:50 [iproute2] libnetlink: reduce size of message sent to kernel Zhang Shengju
@ 2016-11-29 21:07 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2016-11-29 21:07 UTC (permalink / raw)
  To: Zhang Shengju; +Cc: netdev

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-29 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-19 15:50 [iproute2] libnetlink: reduce size of message sent to kernel Zhang Shengju
2016-11-29 21:07 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).