Thread (30 messages) flat view 30 messages, 2 authors, 2017-03-12
STALE3443d

[PATCH net-next RFC v1 10/27] afnetns: add ifa_find_afnetns_rcu

From: Hannes Frederic Sowa <hidden>
Date: 2017-03-12 23:02:13
Subsystem: networking drivers, networking [ipv4/ipv6], the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds

Signed-off-by: Hannes Frederic Sowa <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help