* [PATCH net-next] IPv6: add a function to check for a valid anycast source address
@ 2014-01-13 16:44 Francois-Xavier Le Bail
0 siblings, 0 replies; only message in thread
From: Francois-Xavier Le Bail @ 2014-01-13 16:44 UTC (permalink / raw)
To: netdev
Cc: Hannes Frederic Sowa, David S. Miller, Alexey Kuznetsov,
James Morris, Hideaki Yoshifuji, Patrick McHardy,
Francois-Xavier Le Bail
- Add ipv6_chk_acast_addr_src() to check if an anycast address is link-local
on given interface or is global (on any interface).
Signed-off-by: Francois-Xavier Le Bail <fx.lebail@yahoo.com>
---
include/net/addrconf.h | 5 +++--
net/ipv6/anycast.c | 11 +++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 66c4a44..50e39a8 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -205,8 +205,9 @@ void ipv6_sock_ac_close(struct sock *sk);
int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
- const struct in6_addr *addr);
-
+ const struct in6_addr *addr);
+bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev,
+ const struct in6_addr *addr);
/* Device notifier */
int register_inet6addr_notifier(struct notifier_block *nb);
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 5a80f15..4f2c62a 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -383,6 +383,17 @@ bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
return found;
}
+/* check if address is link-local on given interface
+ * or is global (on any interface)
+ */
+bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev,
+ const struct in6_addr *addr)
+{
+ if (ipv6_addr_type(addr) & IPV6_ADDR_LINKLOCAL)
+ return ipv6_chk_acast_dev(dev, addr);
+ else
+ return ipv6_chk_acast_addr(net, NULL, addr);
+}
#ifdef CONFIG_PROC_FS
struct ac6_iter_state {
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-01-13 17:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 16:44 [PATCH net-next] IPv6: add a function to check for a valid anycast source address Francois-Xavier Le Bail
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox