From patchwork Mon Jan 13 16:59:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: FX Le Bail X-Patchwork-Id: 310259 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CA6BD2C0097 for ; Tue, 14 Jan 2014 04:18:48 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755484AbaAMRSp (ORCPT ); Mon, 13 Jan 2014 12:18:45 -0500 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:35280 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753024AbaAMRSm (ORCPT ); Mon, 13 Jan 2014 12:18:42 -0500 Received: from localhost.localdomain ([86.214.30.166]) by mwinf5d29 with ME id DVJd1n0063b2xSm03VJgrM; Mon, 13 Jan 2014 18:18:41 +0100 From: Francois-Xavier Le Bail To: netdev@vger.kernel.org Cc: Hannes Frederic Sowa , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki Yoshifuji , Patrick McHardy , Francois-Xavier Le Bail Subject: [PATCH net-next v2] IPv6: enable bind() to assign an anycast address Date: Mon, 13 Jan 2014 17:59:37 +0100 Message-Id: <1389632378-4996-1-git-send-email-fx.lebail@yahoo.com> X-Mailer: git-send-email 1.7.10.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org - Use ipv6_chk_acast_addr_src() in inet6_bind(). Signed-off-by: Francois-Xavier Le Bail --- 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(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index c921d5d..68b81e9 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -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; }