Signed-off-by: Hannes Frederic Sowa <han...@stressinduktion.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

Reply via email to