Re: ping to broadcast address: permission denied?

Ingo Molnar (mingo@pc5829.hil.siemens.at)
Fri, 7 Mar 1997 18:55:28 +0100 (MET)


On Fri, 7 Mar 1997, Bryn Paul Arnold Jones wrote:

> > >I have fetched, compiled, and made available Trygve Gudmundsen's
> > >Linux-modified version of Eric Wassenaar's excellent "ping" program. It is
> > >all sitting on on wauug.erols.com in "/pub/net/wassenaar-ping". As Trygve
> > >mentioned his site was about to be down for 5 days I figured this could be
> > >a useful service 8^)
> >
> > I've picked up this version, compiled it, but it still doesn't
> > do what I'd hoped (I had already expected it wasn't a ping code
> > problem).

> This would be a setuid root problem, ie it isn't. Does it work if you run
> the binary as root ?

broadcast sockets must be explicitly enabled. (i think the problem is that
if you ping a broadcast address, you get a packet storm as an answer,
which in turn might make you quite unpopular amongst other users, or
worse, it might alert netadmins, or even worse, it might crash your box)

the relevant lines from setsockopt:

case SO_BROADCAST:
sk->broadcast=valbool;
break;

never tried it tho ;)

-- mingo