From mboxrd@z Thu Jan 1 00:00:00 1970 From: martin zhang Subject: A question about inet_csk_bind_conflict Date: Fri, 30 Mar 2018 19:39:46 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: netdev@vger.kernel.org To: davem@davemloft.net, Eric Dumazet Return-path: Received: from mail-ua0-f180.google.com ([209.85.217.180]:40530 "EHLO mail-ua0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751230AbeC3Ljr (ORCPT ); Fri, 30 Mar 2018 07:39:47 -0400 Received: by mail-ua0-f180.google.com with SMTP id n20so5264156ual.7 for ; Fri, 30 Mar 2018 04:39:46 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: HI all, I have a question about tcp bind check function:inet_csk_bind_conflict. My case: 192.168.56.101:37818 =3D=3D> 192.168.56.193:22 On host A (tcp client: 192.168.56.101), there is a tcp connection to server B(192.168.56.193, tcp server). I want run a tcp server on A, and listen/bind tcp port 37818, but it failed= . I check the kernel source and found it is stopped by inet_csk_bind_conflict= . I think in this case, it should success. Because, 1. when a tcp packet arrives network stack, we firstly look the established/timewait socket, and then search for listen socket. 2. peer side(192.168.56.193:22), is a tcp server. It will never connect to192.168.56.101:37818, with 192.168.56.193:22. I don=E2=80=99t understand why the kernel fail at inet_csk_bind_conflict, I wonder if I ignore some case or it is a bug? Thanks! Martin