Bob Keyes wrote:
> On Fri, 19 Oct 2007, Ralf Friedl wrote:
>> Bob Keyes wrote:
>>> I originally made this for my own needs, contributed it to openwrt 
>>> but think it should go upstream to busybox. I am new here, not sure 
>>> of the regular way I am supposed to make contributions, but whoever 
>>> is in charge of accepting patches please take a look at 
>>> https://dev.openwrt.org/ticket/2522 which will explain the rational 
>>> for the feature and includes the patch for it.
>> Can you explain how this is different from option -I ? From the man 
>> page of the linux ping:
>> -I interface address
>> Set source address to specified interface address. Argument may be 
>> numeric IP address  or  name  of  device.
>> When pinging IPv6 link-local address this option is required.
>>
>> It seems the -I is supposed to accept either an IP address or a 
>> device name. I suggest to keep it compatible.
> in Linux (net-tools) ping this is what -I does. But not in busybox 
> ping. -I is used for another option in busybox ping.
Busybox ping says:
        -I iface/IP     Use interface or IP address as source

iputils ping says:
        -I interface (or) address

So both seem to agree. The problem might be that in busybox ping the -I 
is not fully implemented. Busybox ping even contains code to detect 
whether the argument to -I is a device or an address. It just seems that 
if_index is only used for IPV6 ping and not for IPV4 ping.

In iputils ping the code for option -I is like this:
    if (optarg is IP-Address)
        ...
    else
        setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, optarg, 
strlen(optarg)+1)

This seems to be exactly what your code does for option -n. I suggest to 
do the same with the option -I, as it was already intended and to keep 
both versions of ping compatible.

Regards
Ralf Friedl
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to