From patchwork Tue Mar 5 18:11:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Leitner X-Patchwork-Id: 225146 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 E31E32C0342 for ; Wed, 6 Mar 2013 05:12:55 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758054Ab3CESMu (ORCPT ); Tue, 5 Mar 2013 13:12:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:14648 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756434Ab3CESMt (ORCPT ); Tue, 5 Mar 2013 13:12:49 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r25ICmPX022412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Mar 2013 13:12:48 -0500 Received: from localhost (vpn1-5-58.gru2.redhat.com [10.97.5.58]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r25ICkeq007510; Tue, 5 Mar 2013 13:12:47 -0500 From: Flavio Leitner To: netdev Cc: Hideaki YOSHIFUJI , Flavio Leitner Subject: [PATCH net-next] tcp: ipv6: bind() use stronger condition for bind_conflict Date: Tue, 5 Mar 2013 15:11:01 -0300 Message-Id: <1362507061-22475-1-git-send-email-fbl@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We must try harder to get unique (addr, port) pairs when doing port autoselection for sockets with SO_REUSEADDR option set. This is a continuation of commit aacd9289af8b82f5fb01bcdd53d0e3406d1333c7 for IPv6. Signed-off-by: Flavio Leitner --- net/ipv6/inet6_connection_sock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index b386a2c..f7f49bf 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c @@ -55,6 +55,10 @@ int inet6_csk_bind_conflict(const struct sock *sk, if (ipv6_rcv_saddr_equal(sk, sk2)) break; } + if (!relax && reuse && sk2->sk_reuse && + sk2->sk_state != TCP_LISTEN && + ipv6_rcv_saddr_equal(sk, sk2)) + break; } }