From hmo@sep.oldach.net  Mon Aug  9 11:28:59 2004
Return-Path: <hmo@sep.oldach.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id B1B9416A4CE; Mon,  9 Aug 2004 11:28:59 +0000 (GMT)
Received: from sep.oldach.net (p5081C48F.dip0.t-ipconnect.de [80.129.196.143])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 57BAF43D49; Mon,  9 Aug 2004 11:28:56 +0000 (GMT)
	(envelope-from hmo@sep.oldach.net)
Received: from sep.oldach.net (localhost [127.0.0.1])
	by sep.oldach.net (8.12.11/8.12.11/hmo30jul04) with ESMTP id i79BSQV4044280
	(version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO);
	Mon, 9 Aug 2004 13:28:44 +0200 (CEST)
	(envelope-from hmo@sep.oldach.net)
Received: (from hmo@localhost)
	by sep.oldach.net (8.12.11/8.12.11/Submit) id i79BSPZS044279;
	Mon, 9 Aug 2004 13:28:25 +0200 (CEST)
	(envelope-from hmo)
Message-Id: <200408091128.i79BSPZS044279@sep.oldach.net>
Date: Mon, 9 Aug 2004 13:28:25 +0200 (CEST)
From: Helge Oldach <datapipeaug04@oldach.net>
Reply-To: Helge Oldach <datapipeaug04@oldach.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: roam@freebsd.org
Subject: ports/net/datapipe shouldn't bind to listen address (with patch)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         70205
>Category:       ports
>Synopsis:       ports/net/datapipe shouldn't bind to listen address (with patch)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    roam
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 09 11:30:23 GMT 2004
>Closed-Date:    Fri Jul 01 17:22:13 GMT 2005
>Last-Modified:  Fri Jul 01 17:22:13 GMT 2005
>Originator:     Helge Oldach
>Release:        FreeBSD 4.10-STABLE i386
>Organization:
>Environment:
System: FreeBSD localhost 4.10-STABLE FreeBSD 4.10-STABLE #1945: Sun Aug 1 13:39:01 CEST 2004 toor@localhost:/usr/obj/usr/src/sys/GENERIC i386


	
>Description:

ports/net/datapipe is currently using the address it listens on as the
address for outgoing connections. This is a problem for multi-homed
hosts, where the outgoing address normally should be assigned according
to the routing table.

For example consider a multi-homed host with interfaces 10.0.0.1/24 and
10.1.1.1/24

	datapipe 10.0.0.1 100 10.1.1.219 100

would listen on 10.0.0.1 and forward incoming sessions to host
10.1.1.219, using the source address 10.0.0.1 for the forwarded TCP
session. It should however use the address of the outgoing interface,
that is 10.1.1.1.

	
>How-To-Repeat:
	
>Fix:

	
--- datapipe.c.ORIG	Tue Jan  4 07:48:55 2000
+++ datapipe.c	Mon Aug  9 13:10:56 2004
@@ -164,9 +164,10 @@
   }
 
 
-  /* change the port in the listener struct to zero, since we will
-   * use it for binding to outgoing local sockets in the future. */
+  /* change the port and address in the listener struct to zero, since we will
+   * use it for binding to outgoing local sockets and address in the future. */
   laddr.sin_port = htons(0);
+  laddr.sin_addr.s_addr = INADDR_ANY;
 
 
   /* fork off into the background. */

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: roam 
State-Changed-When: Mon Aug 9 11:40:12 GMT 2004 
State-Changed-Why:  
I'll include this in a patch that I'll commit to the port shortly. 
Thanks! 


Responsible-Changed-From-To: freebsd-ports-bugs->roam 
Responsible-Changed-By: roam 
Responsible-Changed-When: Mon Aug 9 11:40:12 GMT 2004 
Responsible-Changed-Why:  
My port. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70205 
State-Changed-From-To: analyzed->closed 
State-Changed-By: roam 
State-Changed-When: Fri Jul 1 17:22:00 GMT 2005 
State-Changed-Why:  
Patch committed as part of my changes, thanks! 

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