From cejkar@fit.vutbr.cz  Tue Jan 18 09:52:57 2005
Return-Path: <cejkar@fit.vutbr.cz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5A65E16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Jan 2005 09:52:57 +0000 (GMT)
Received: from kazi.fit.vutbr.cz (kazi.fit.vutbr.cz [147.229.8.12])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 25F2D43D58
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Jan 2005 09:52:56 +0000 (GMT)
	(envelope-from cejkar@fit.vutbr.cz)
Received: from kazi.fit.vutbr.cz (localhost [127.0.0.1])
	by kazi.fit.vutbr.cz (8.12.11/8.12.11) with ESMTP id j0I9qr2c045666
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Jan 2005 10:52:53 +0100 (CET)
Received: (from cejkar@localhost)
	by kazi.fit.vutbr.cz (8.12.11/8.12.5/Submit) id j0I9qr8k045665;
	Tue, 18 Jan 2005 10:52:53 +0100 (CET)
Message-Id: <200501180952.j0I9qr8k045665@kazi.fit.vutbr.cz>
Date: Tue, 18 Jan 2005 10:52:53 +0100 (CET)
From: Rudolf Cejka <cejkar@fit.vutbr.cz>
Reply-To: Rudolf Cejka <cejkar@fit.vutbr.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] sendto(2) is missing possible error EISCONN
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         76399
>Category:       docs
>Synopsis:       [PATCH] sendto(2) is missing possible error EISCONN
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    keramida
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 18 10:00:46 GMT 2005
>Closed-Date:    Mon Jan 31 00:27:34 GMT 2005
>Last-Modified:  Mon Jan 31 00:27:34 GMT 2005
>Originator:     Rudolf Cejka
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
FIT, Brno University of Technology, Czech Republic
>Environment:
>Description:
 
 SUSv3 says for sendto():
 
   [EISCONN] A destination address was specified and the socket is already
   connected. This error may or may not be returned for connection mode
   sockets.
 
 FreeBSD does it in the first way (whereas Linux in the second) and the
 error in case of non-NULL destination address is reported. However, the
 manual page is quiet about it:
 
 --- lib/libc/sys/send.2.orig	Tue Jan 18 10:38:19 2005
 +++ lib/libc/sys/send.2	Tue Jan 18 10:39:14 2005
 @@ -186,6 +186,8 @@
  from the last message sent.
  This typically means that the
  receiver is not listening on the remote port.
 +.It Bq Er EISCONN
 +A destination address was specified and the socket is already connected.
  .It Bq Er EHOSTDOWN
  The remote host was down.
  .It Bq Er ENETDOWN
 
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:

From: Giorgos Keramidas <keramida@freebsd.org>
To: Rudolf Cejka <cejkar@fit.vutbr.cz>
Cc: bug-followup@freebsd.org
Subject: Re: docs/76399: [PATCH] sendto(2) is missing possible error EISCONN
Date: Wed, 19 Jan 2005 13:06:54 +0200

 On 2005-01-18 10:52, Rudolf Cejka <cejkar@fit.vutbr.cz> wrote:
 > SUSv3 says for sendto():
 >
 > [EISCONN] A destination address was specified and the socket is
 > already connected. This error may or may not be returned for
 > connection mode sockets.
 >
 > FreeBSD does it in the first way (whereas Linux in the second) and
 > the error in case of non-NULL destination address is reported.
 
 Hi Rudolf,
 
 I tried reproducing the EISCONN error with the program at:
 
 	http://people.freebsd.org/~keramida/files/conn.c
 
 A connection is made to localhost:22 (sshd must be running for this to
 succeed), and then sendto() is used to send a packet to a different
 host over the same socket.
 
 EISCONN was never returned in 6.0-CURRENT.  The packet is AFAICT
 silently dropped.
 
 Am I doing something wrong?
 
 - Giorgos
 

From: Rudolf Cejka <cejkar@fit.vutbr.cz>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: docs/76399: [PATCH] sendto(2) is missing possible error EISCONN
Date: Wed, 19 Jan 2005 13:00:03 +0100

 Giorgos Keramidas wrote (2005/01/19):
 > A connection is made to localhost:22 (sshd must be running for this to
 > succeed), and then sendto() is used to send a packet to a different
 > host over the same socket.
 > 
 > EISCONN was never returned in 6.0-CURRENT.  The packet is AFAICT
 > silently dropped.
 > 
 > Am I doing something wrong?
 
 Oops, I'm sorry that you had to create some testing example
 - it was possible that I could send one...
 
 Just change SOCK_STREAM to SOCK_DGRAM. However, I do not understand,
 why there is a difference between SOCK_STREAM and SOCK_DGRAM, because
 I thought from ipc_usrreq.c in /usr/src/sys, that the behavioour
 should be the same.
 
 Thank you very much.
 
 -- 
 Rudolf Cejka <cejkar at fit.vutbr.cz> http://www.fit.vutbr.cz/~cejkar
 Brno University of Technology, Faculty of Information Technology
 Bozetechova 2, 612 66  Brno, Czech Republic
State-Changed-From-To: open->patched 
State-Changed-By: keramida 
State-Changed-When: Mon Jan 24 20:42:29 GMT 2005 
State-Changed-Why:  
I've committed a description of EISCONN to send.2 in CURRENT. 
Thanks for the constructive discussion :) 


Responsible-Changed-From-To: freebsd-doc->keramida 
Responsible-Changed-By: keramida 
Responsible-Changed-When: Mon Jan 24 20:42:29 GMT 2005 
Responsible-Changed-Why:  
I will MFC this in a week or so. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=76399 
State-Changed-From-To: patched->closed 
State-Changed-By: keramida 
State-Changed-When: Mon Jan 31 00:27:16 GMT 2005 
State-Changed-Why:  
Merged to RELENG_5. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=76399 
>Unformatted:
