From patchwork Wed May 9 12:30:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Leitner X-Patchwork-Id: 157937 X-Patchwork-Delegate: shemminger@vyatta.com 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 D70B8B6FE0 for ; Wed, 9 May 2012 22:31:10 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759021Ab2EIMbC (ORCPT ); Wed, 9 May 2012 08:31:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22542 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758858Ab2EIMa7 (ORCPT ); Wed, 9 May 2012 08:30:59 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q49CUwE3019119 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 May 2012 08:30:58 -0400 Received: from localhost (ovpn-113-138.phx2.redhat.com [10.3.113.138]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q49CUvTl004175; Wed, 9 May 2012 08:30:58 -0400 From: Flavio Leitner To: mtk.manpages@gmail.com Cc: linux-man@vger.kernel.org, netdev , Flavio Leitner Subject: [PATCH] ip.7: Improve explanation about calling listen or connect Date: Wed, 9 May 2012 09:30:36 -0300 Message-Id: <1336566636-14713-1-git-send-email-fbl@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Flavio Leitner --- man7/ip.7 | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/man7/ip.7 b/man7/ip.7 index 9f560df..84fe32d 100644 --- a/man7/ip.7 +++ b/man7/ip.7 @@ -69,12 +69,11 @@ For you may specify a valid IANA IP protocol defined in RFC\ 1700 assigned numbers. .PP -.\" FIXME ip current does an autobind in listen, but I'm not sure -.\" if that should be documented. When a process wants to receive new incoming packets or connections, it should bind a socket to a local interface address using .BR bind (2). -Only one IP socket may be bound to any given local (address, port) pair. +In this case, only one IP socket may be bound to any given local +(address, port) pair. When .B INADDR_ANY is specified in the bind call, the socket will be bound to @@ -82,10 +81,14 @@ is specified in the bind call, the socket will be bound to local interfaces. When .BR listen (2) -or +is called on an unbound socket, the socket is automatically bound +to a random free port with the local address set to +.BR INADDR_ANY . +When .BR connect (2) -are called on an unbound socket, it is automatically bound to a -random free port with the local address set to +is called on an unbound socket, the socket is automatically bound +to a random free port or an usable shared port with the local address +set to .BR INADDR_ANY . A TCP local socket address that has been bound is unavailable for