[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170312230151.5185-11-hannes@stressinduktion.org>
Date: Mon, 13 Mar 2017 00:01:34 +0100
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: netdev@...r.kernel.org
Subject: [PATCH net-next RFC v1 10/27] afnetns: add ifa_find_afnetns_rcu
Signed-off-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
---
include/linux/inetdevice.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index eb1b662f62626f..01cbcfe93383b7 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -180,6 +180,17 @@ static __inline__ bool inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
return !((addr^ifa->ifa_address)&ifa->ifa_mask);
}
+static inline struct afnetns *ifa_find_afnetns_rcu(struct net *net, __be32 addr)
+{
+#if IS_ENABLED(CONFIG_AFNETNS)
+ struct in_ifaddr *ifa = ifa_find_rcu(net, addr);
+
+ return ifa ? ifa->afnetns : net->afnet_ns;
+#else
+ return NULL;
+#endif
+}
+
/*
* Check if a mask is acceptable.
*/
--
2.9.3
Powered by blists - more mailing lists