From owner-freebsd-questions Mon Aug 21 11:37:17 2000 Delivered-To: freebsd-questions@freebsd.org Received: from smtp.nettoll.com (matrix.fr.uu.net [212.155.143.61]) by hub.freebsd.org (Postfix) with ESMTP id 316A337B422 for ; Mon, 21 Aug 2000 11:37:13 -0700 (PDT) Received: by smtp.nettoll.com; Mon, 21 Aug 2000 20:32:13 +0200 (MET DST) Message-Id: <4.3.0.20000821203212.02e2f750@pop.free.fr> X-Sender: usebsd@pop.free.fr X-Mailer: QUALCOMM Windows Eudora Version 4.3 Date: Mon, 21 Aug 2000 20:44:14 +0200 To: nimrodm@email.com, freebsd-questions@FreeBSD.ORG From: mouss Subject: Re: Can a tcp client use bind to force which interface is to be used? In-Reply-To: <20000815185950.A1403@localhost.bsd.net.il> References: <20000814185251.11423.qmail@camelot.bitart.com> <20000814185251.11423.qmail@camelot.bitart.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I am not fully convinced here. normally, you have no control over the interface. you can choose the IP address used as the source, but routing uses the destination address, not the source address. the "-s" option for ping makes it use a specific address, insead of setting the address to 0 and relying on routing to determine the outgoing interface. all the places in ip_output where I see the src ip "corrected" are in multicast and in the case the src ip is empty. I don't see the point in using a specific inteface when the packet must go another way! the only "reasonable" case is when both interfaces are physicall connected to the same network. (I haven't checked what the SO_DONTROUTE might provide....). regards, mouss At 18:59 15/08/00 +0300, Nimrod Mesika wrote: >On Mon, Aug 14, 2000 at 01:52:50PM -0500, Gerd Knops wrote: > > Hi everyone, > > > > Looking through Stevens this questions doesn't seem to be answered: > > > > If I use bind() for an outbound socket connection to set the source > > IP-address, does this mean that the interface associated with that > > IP-address is used (as opposed to the interface dictated by the routing > > table for the given target IP)? > > > >Yes you can. > >For an example, see the /usr/src/sbin/ping/ping.c (the -s option of >ping). > >-- >Nimrod. >http://www.geocities.com/rodd_27 > > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message