netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: netdev@vger.kernel.org
Subject: [v3 RFC PATCH 4/8] netlink: Add NLM_F_NOREPLY flags.
Date: Wed, 02 Mar 2011 17:02:02 -0800 (PST)	[thread overview]
Message-ID: <20110302.170202.191408625.davem@davemloft.net> (raw)


It is used to bypass the response generation for "GET" type
operations.

This mechanism can then be used to allow a query operation to be used
in a "benchmarking" role, since the actual overhead of the netlink
communications will be muted.

The first query to support this is inet_rtm_getroute().

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/linux/netlink.h |    2 ++
 net/ipv4/route.c        |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index e2b9e63..a4bc8d2 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -61,6 +61,8 @@ struct nlmsghdr {
 #define NLM_F_CREATE	0x400	/* Create, if it does not exist	*/
 #define NLM_F_APPEND	0x800	/* Add to end of list		*/
 
+#define NLM_F_NOREPLY	0x1000	/* Do not generate reply	*/
+
 /*
    4.4BSD ADD		NLM_F_CREATE|NLM_F_EXCL
    4.4BSD CHANGE	NLM_F_REPLACE
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index efefefa..e59241f 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2110,6 +2110,9 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
 		goto errout_free;
 
 	skb_dst_set(skb, &rt->dst);
+	if (nlh->nlmsg_flags & NLM_F_NOREPLY)
+		goto errout_free;
+
 	if (rtm->rtm_flags & RTM_F_NOTIFY)
 		rt->rt_flags |= RTCF_NOTIFY;
 
-- 
1.7.4.1


                 reply	other threads:[~2011-03-03  1:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110302.170202.191408625.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).