Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Aug 2000 20:44:14 +0200
From:      mouss <usebsd@free.fr>
To:        nimrodm@email.com, freebsd-questions@FreeBSD.ORG
Subject:   Re: Can a tcp client use bind to force which interface is to be used?
Message-ID:  <4.3.0.20000821203212.02e2f750@pop.free.fr>
In-Reply-To: <20000815185950.A1403@localhost.bsd.net.il>
References:  <20000814185251.11423.qmail@camelot.bitart.com> <20000814185251.11423.qmail@camelot.bitart.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4.3.0.20000821203212.02e2f750>