Skip to contentSkip to conversation

IPv6: enable bind() to assign an anycast address

PATCH Superseded Francois-Xavier Le Bail 1 participant 1 message Jan 13, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 IPv6: enable bind() to assign an anycast address

- Use ipv6_chk_acast_addr_src() in inet6_bind().

---
Tested with SOCK_DGRAM and SOCK_STREAM sockets. Tested with link-local and global anycast addresses.

 net/ipv6/af_inet6.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/af_inet6.c +3 -1
index c921d5d..68b81e9 100644
@@ -347,7 +347,9 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 			if (!(addr_type & IPV6_ADDR_MULTICAST))	{
 				if (!(inet->freebind || inet->transparent) &&
 				    !ipv6_chk_addr(net, &addr->sin6_addr,
-						   dev, 0)) {
+						   dev, 0) &&
+				    !ipv6_chk_acast_addr_src(net, dev,
+							     &addr->sin6_addr)) {
 					err = -EADDRNOTAVAIL;
 					goto out_unlock;
 				}