Re: ping to broadcast address: permission denied?

Bryn Paul Arnold Jones (bpaj@gytha.demon.co.uk)
Fri, 7 Mar 1997 15:37:33 +0000 (GMT)


On Fri, 7 Mar 1997, Paul Slootman wrote:

> Niemi@linux.wauug.org 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).
>
> The problem is this:
>
> I'm on a subnetted B-class network (141.93.34.0, netmask 255.255.255.0).
> This all works fine, however I cannot ping the broadcast address (which
> is 141.93.34.255). Ping says:
>
> # ./ping 141.93.34.255
> PING 141.93.34.255: 56 data bytes
> sendto: Permission denied
> no reply from 141.93.34.255 within 1 sec
> sendto: Permission denied
>
> ---- 141.93.34.255 PING Statistics ----
> 2 packets transmitted, 0 packets received, 100% packet loss
>

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

> This works perfectly from a Solaris 2.5 system on the same network...
> I tried tracing this into the kernel, but at a certain point I get
> lost. It's definitely sendto() that returns -1 EACCES, according to
> strace.
>

Yep, the solaris binary will be setuid root.

> Same thing when pinging the loopback broadcast address 127.255.255.255,
> so it doesn't look like it's a subnetting problem.
>

Try setting the setuid bit on the binary:

chown root.root ping; chmod 4555 ping

It should now look like:

-r-sr-xr-x 1 root root 12272 Jan 31 22:32 ping*
^ setuid bit.

> Anyone know what the problem is? Even better, what the solution is?
> Vanilla 2.0.29.
>
>
> Paul Slootman
> --
Bryn

--
PGP key pass phrase forgotten,   \ Overload -- core meltdown sequence 
again :( and I don't care ;)      |            initiated.
                                 / This space is intentionally left   
                                |  blank, apart from this text ;-)
                                 \____________________________________