Re: ping to broadcast address: permission denied?

Illuminati Primus (vermont@gate.net)
Fri, 7 Mar 1997 15:18:13 -0500 (EST)


No, I have written c progs that write to broadcast addresses using
sendto(), and it gives the permission denied error. There might be a
chance that I have to initialize the device some special way.. (?)
Someone mentioned that SO_BROADCAST has to be set..

On Fri, 7 Mar 1997, Ed Saffle wrote:

> That's strange, it works just fine for me. It just complains a
> lot about duplicate answers which is correct since it is in fact
> getting muliple answers back for each sequence number. Maybe you
> both just need a newer version of ping?
>
> Illuminati Primus writes:
> > If you would have actually tried first to see if you could verify your
> > claim, maybe you wouldn't have made such a fool of yourself.
> >
> > Observe:
> >
> > utopia:~$ ls -al /bin/ping
> > -r-sr-xr-x 1 root bin 17412 Feb 18 1995 /bin/ping
> > utopia:~$ ifconfig eth0
> > eth0 Link encap:10Mbps Ethernet HWaddr 00:00:C0:F0:75:0E
> > inet addr:206.84.74.11 Bcast:206.84.74.255 Mask:255.255.255.0
> > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> > RX packets:0 errors:927673 dropped:0 overruns:0
> > TX packets:0 errors:0 dropped:620623 overruns:2
> > (yeah ill upgrade ifconfig sometime :)
> > Interrupt:10 Base address:0x6000
> >
> > utopia:~$ ping 206.84.74.255
> > PING 206.84.74.255 (206.84.74.255): 56 data bytes
> > ping: sendto: Permission denied
> > ping: wrote 206.84.74.255 64 chars, ret=-1
> > ping: sendto: Permission denied
> > ping: wrote 206.84.74.255 64 chars, ret=-1
> >
> > --- 206.84.74.255 ping statistics ---
> > 2 packets transmitted, 0 packets received, 100% packet loss
> >
> > Obviously this is running as root...
> > And pinging the broadcast address is still failing...
> > Any network gurus know why?
> >
> > PS
> > Maybe you could have noticed his '#' prompt... sure, thats doesn't
> > necessarily imply that he is root, but its usually the case.
> >
> > On Fri, 7 Mar 1997, Bryn Paul Arnold Jones wrote:
> >
> > > 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 Tryg
> >ve
> > > > >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 ;-)
> > > \____________________________________
> > >
> >
>
>