[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170312230151.5185-16-hannes@stressinduktion.org>
Date: Mon, 13 Mar 2017 00:01:39 +0100
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: netdev@...r.kernel.org
Subject: [PATCH net-next RFC v1 15/27] afnetns: add ipv6_get_ifaddr_afnetns_rcu
Signed-off-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
---
include/net/addrconf.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index e3f1920ca57968..644fa68bb4ddef 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -104,6 +104,23 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
u32 addr_flags, bool sllao, bool tokenized,
__u32 valid_lft, u32 prefered_lft);
+static inline
+struct afnetns *ipv6_get_ifaddr_afnetns_rcu(struct net *net,
+ const struct in6_addr *addr,
+ struct net_device *dev)
+{
+#if IS_ENABLED(CONFIG_AFNETNS)
+ struct inet6_ifaddr *ifp;
+
+ ifp = ipv6_get_ifaddr(net, addr, dev, 1);
+ if (ifp)
+ return ifp->afnetns;
+ return net->afnet_ns;
+#else
+ return NULL;
+#endif
+}
+
static inline int addrconf_ifid_eui48(u8 *eui, struct net_device *dev)
{
if (dev->addr_len != ETH_ALEN)
--
2.9.3
Powered by blists - more mailing lists