On Wednesday 15 July 2009 13:10, Javier Viguera wrote:
> Hi all,
> 
> Just an issue i found when doing a little test with ping applet. Using 
> current git i build busybox with only "ping" applet:
> 
> busybox.git$ git rev-parse HEAD
> 0ad438b12a97159c43c9bfc75a4ae4873ecf9bf9
> 
> busybox.git$ make allnoconfig
> 
> busybox.git$ make menuconfig
> (select just ping applet)
> 
> busybox.git$ make
> 
> After compiling i make a little test with the "-I" option of ping. 
> According to ping's help:
> 
>     "-I iface/IP     Use interface or IP address as source"
> 
> I have a network card in my PC with IP address 192.168.105.1.
> 
> busybox.git$ ifconfig eth1
> eth1      Link encap:Ethernet  HWaddr 00:0e:0c:34:11:fa
>            inet addr:192.168.105.1  Bcast:192.168.255.255  Mask:255.255.0.0
>            inet6 addr: fe80::20e:cff:fe34:11fa/64 Scope:Link
>            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>            RX packets:3584314 errors:0 dropped:0 overruns:0 frame:0
>            TX packets:1073306 errors:0 dropped:0 overruns:0 carrier:0
>            collisions:0 txqueuelen:100
>            RX bytes:2660837294 (2.4 GB)  TX bytes:560001009 (534.0 MB)
>            Base address:0xdcc0 Memory:fe6c0000-fe6e0000
> 
> 
> When i try to ping the interface itself with the -I option, it only 
> works if i set the IP address, but not the interface name:
> 
> busybox.git$ sudo ./busybox -I eth1 192.168.105.1
> PING 192.168.105.1 (192.168.105.1): 56 data bytes
> 
> --- 192.168.105.1 ping statistics ---
> 2 packets transmitted, 0 packets received, 100% packet loss
> 
> busybox.git$ sudo ./busybox -I 192.168.105.1 192.168.105.1
> PING 192.168.105.1 (192.168.105.1) from 192.168.105.1: 56 data bytes
> 64 bytes from 192.168.105.1: seq=0 ttl=64 time=0.052 ms
> 64 bytes from 192.168.105.1: seq=1 ttl=64 time=0.064 ms
> 64 bytes from 192.168.105.1: seq=2 ttl=64 time=0.069 ms
> 
> --- 192.168.105.1 ping statistics ---
> 3 packets transmitted, 3 packets received, 0% packet loss
> round-trip min/avg/max = 0.052/0.061/0.069 ms
> 
> Is this the normal behavior? or have i hit a bug?

Yes, it's normal.

Think about it. When you ping *yourself*,
do ping packets really go over the physical wire?

Of course not. They exist only inside your computer.

In other words, they go over _loopback interface_!

Proof:

# ip a
1: lo: <LOOPBACK,UP,10000> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:1d:7d:c2:ec:70 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/24 brd 10.0.0.255 scope global if

# ./busybox ping -I eth0 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 56 data bytes
^C
--- 10.0.0.1 ping statistics ---
2 packets transmitted, 0 packets received, 100% packet loss

# ./busybox ping -I lo 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 56 data bytes
64 bytes from 10.0.0.1: seq=0 ttl=64 time=0.089 ms
64 bytes from 10.0.0.1: seq=1 ttl=64 time=0.064 ms
64 bytes from 10.0.0.1: seq=2 ttl=64 time=0.065 ms
^C
--- 10.0.0.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.064/0.072/0.089 ms


--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to