[PATCH] ping: try SOCK_DGRAM if no root privileges

John Spencer maillist-busybox at barfooze.de
Sat Jan 4 20:31:32 UTC 2014


Denys Vlasenko wrote:
> Applied, thanks.

i just tested this new functionality, and it hangs at recv and does 
nothing until the alarm is triggered:

  c = recv(pingsock, G.packet, sizeof(G.packet), 0);

(note: in order to test one has to echo groupid groupid > 
/proc/sys/net/ipv4/ping_group_range as described in the kernel commit:

https://lkml.org/lkml/2011/5/13/382 )

OTOH using the iputils source tarball provided on the kernel patch 
authors ping info page
( http://openwall.info/wiki/people/segoon/ping ) + the patch there, the 
resulting ping binary successfully is able to ping as an ordinary user 
without special privileges, as long as the groupid matches the range)
i fixed a couple compile errors in that version of iputils and squashed 
the needed ping code from that tarball into a single standalone 2KLOC C 
file - see attachment.

> 
> On Tue, Nov 26, 2013 at 10:18 PM, Daniel Borca <dborca at yahoo.com> wrote:
>> Allow non-setuid ping.
>>
>> Reference:
>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c319b4d76b9e583a5d88d6bf190e079c4e43213d
>>
>> -dborca
>>
>> _______________________________________________
>> busybox mailing list
>> busybox at busybox.net
>> http://lists.busybox.net/mailman/listinfo/busybox
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ping.c
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140104/b3875064/attachment-0001.c>


More information about the busybox mailing list