Skip to contentSkip to conversation

netlink: Add NLM_F_NOREPLY flags.

RFC PATCH New David Miller 1 participant 1 message Mar 13, 2011

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

RFC PATCH v4 4/8 netlink: Add NLM_F_NOREPLY flags.

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

---
 include/linux/netlink.h |    2 ++
 net/ipv4/route.c        |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
include/linux/netlink.h +2 -0
index 4c4ac3f..a63c0e5 100644
@@ -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
net/ipv4/route.c +3 -0
index 6036476..96dd498 100644
@@ -2130,6 +2130,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;
 
Signature · 1 line
1.7.4.1