Subject: Re: how to get FreeBSD ping.c into NetBSD?
To: Hubert Feyrer <hubert@feyrer.de>
From: Gert Doering <gert@greenie.muc.de>
List: tech-net
Date: 11/22/2006 20:20:07
Hi,
On Wed, Nov 22, 2006 at 08:10:18PM +0100, Hubert Feyrer wrote:
> On Wed, 22 Nov 2006, David Young wrote:
> > -I ifaddr
> > Send multicast datagrams on the network interface specified by
> > the interface's hostname or IP address.
>
> How about:
>
> -I ipaddr
> Send datagrams on the network interface specified by the
> interface's hostname or IP address,
Hmmm, that's not actually what it's doing ("send out on *that* network
interface"). It's just using that IP address, and sending out the
packets via the normal routing table (unless "-r" is set).
More like:
-I ipaddr
Send datagrams using the specified source IP address. This option
can be used to force the source address to be [...]
> and use that as the source address of outgoing packets.
> On hosts with more than one IP
> address, this option can be used to force the source address to be
> something other than the IP address of the interface the probe
> packet is sent on. If the IP address is not one of this machine's
> interface addresses, an error is returned and nothing is sent.
>
> (taken mostly from FreeBSD; someone please confirm if the error handling
> is actually true!)
Yep, the error handling works:
gert@delta.greenie.net:/home/gert$ ping -I 96.0.16.1 195.30.0.1
...
64 bytes from 195.30.0.1: icmp_seq=0 ttl=61 time=1.553 ms
...
gert@delta.greenie.net:/home/gert$ ping -I 96.0.16.2 195.30.0.1
ping: Can't set source interface/address: Can't assign requested address
(96.0.16.1 is an alias on lo0, used for routing/IPSEC tests)
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@greenie.muc.de
fax: +49-89-35655025 gert@net.informatik.tu-muenchen.de