ICMP Ping to broadcast broken ?

ICMP Ping to broadcast broken ?

Post by Kevin Martine » Mon, 06 Mar 1995 12:51:42



I'm not sure if this is a algorithmic or philosophical problem but
pinging my broadcast address fails under Linux (although it works fine in
Solaris and SunOS).

This is the result of such an attempt (as root):
-----------------------------------------------

bash# ping -v 146.174.64.255
PING 146.174.64.255 (146.174.64.255): 56 data bytes
ping: sendto: Permission denied
ping: wrote 146.174.64.255 64 chars, ret=-1
ping: sendto: Permission denied
ping: wrote 146.174.64.255 64 chars, ret=-1
^C
--- 146.174.64.255 ping statistics ---
2 packets transmitted, 0 packets received, 100% packet loss

Local Setup and stats:
---------------------

bash# ifconfig -a
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Bcast:127.255.255.255  Mask:255.0.0.0
          UP BROADCAST LOOPBACK RUNNING  MTU:2000  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0
          TX packets:643267 errors:2 dropped:0 overruns:0

eth0      Link encap:10Mbps Ethernet  HWaddr 02:60:8C:AC:37:5F
          inet addr:146.174.64.124  Bcast:146.174.64.255  Mask:255.255.255.0
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:1338789 errors:6 dropped:7 overruns:0
          TX packets:595844 errors:0 dropped:0 overruns:0
          Interrupt:5 Base address:0x280 Memory:dc000-de000

bash# netstat -r
Kernel routing table
Destination     Gateway         Genmask         Flags Metric Ref Use    Iface
localnet        *               255.255.255.0   U     0      0   297848 eth0
loopback        *               255.0.0.0       U     0      0   643378 lo
default         ciscob4fl1.qntm 0.0.0.0         UG    0      0   297010 eth0
bash#

=============================

The same thing done on the Solaris machine:
------------------------------------------

bash# ping -sv 146.174.64.255
PING 146.174.64.255: 56 data bytes
64 bytes from beavis (146.174.64.109): icmp_seq=0. time=3. ms
64 bytes from ciscob4fl1 (146.174.64.1): icmp_seq=0. time=25. ms
64 bytes from tako (146.174.64.124): icmp_seq=0. time=28. ms

[deleted most of responses...]
^C
----146.174.64.255 PING Statistics----
2 packets transmitted, 39 packets received, 19.50 times amplification
round-trip (ms)  min/avg/max = 1/96/222

Local Setup and Stats:
---------------------

bash# ifconfig -a
lo0: flags=849<UP,LOOPBACK,RUNNING,MULTICAST> mtu 8232
        inet 127.0.0.1 netmask ff000000
le0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500
        inet 146.174.64.109 netmask ffffff00 broadcast 146.174.64.255
        ether 0:3:e3:c0:8:db
bash# netstat -r

Routing Table:
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
localhost            localhost             UH       0    890  lo0
146.174.64.0          beavis                U        3   1176  le0
BASE-ADDRESS.MCAST.NET beavis                U        3      0  le0
default              ciscob4fl1            UG       0      0  
bash#

==============================

Any ideas why the difference?
--
------------------------------------------------------------------------
 Kevin Martinez                 |           Fry's Electronics: Where

------------------------------------------------------------------------

 
 
 

ICMP Ping to broadcast broken ?

Post by Marek Michalkiewi » Wed, 08 Mar 1995 04:41:59


: I'm not sure if this is a algorithmic or philosophical problem but
: pinging my broadcast address fails under Linux (although it works fine in
: Solaris and SunOS).

This is because ping doesn't set the SO_BROADCAST socket option.
I've just sent the patch for this and "ping -f localhost" to Florian.
The fixed version is available here as well:

ftp://ftp.ists.pwr.wroc.pl/pub/linux/bugfixes/ping.tar.gz

But please be nice to this little Linux box and try to ftp
in off-peak hours (local time is GMT+1).  Thanks!



 
 
 

ICMP Ping to broadcast broken ?

Post by Rikhardur Egilss » Sat, 11 Mar 1995 18:03:21



Quote:>I'm not sure if this is a algorithmic or philosophical problem but
>pinging my broadcast address fails under Linux (although it works fine in
>Solaris and SunOS).

[ehrmm, well, yes]

I patched a version of ping to be able to do just that.
The patch is simple, just added the lines:

if( setsockopt( s, SOL_SOCKET, SO_BROADCAST, (char *)&hold,
        sizeof(hold) ) < 0 ) {
         perror( "ping: setsockopt" );
         exit(1);
 }

, at the appropriate place in the source.

If anyone knows how to get this little patch to the distribution-people
please let me know.

_________________________________________________________________
| Rikhardur Egilsson    | I come from the land of Ice and snow  |

| TF3RET                |          hot streams flow.            |
-----------------------------------------------------------------

 
 
 

ICMP Ping to broadcast broken ?

Post by Alan C » Fri, 17 Mar 1995 21:11:01



>I'm not sure if this is a algorithmic or philosophical problem but
>pinging my broadcast address fails under Linux (although it works fine in
>Solaris and SunOS).

It works on SunOS because there is a bug in ping (it forgets to set the broadcast
option), and a bug in BSD kernels that means they forget to check the flag
on raw sockets.

Alan
--
  ..-----------,,----------------------------,,----------------------------,,

 ``----------'`--[Anti Kibozing Signature]-'`----------------------------''
One two three: Kibo, Lawyer, Refugee :: Green card, Compaq come read me...