On 2/25/20 12:27 PM, Longjun Luo wrote: > Hi guys: > > Recently, I just got in touch with toybox. And I have some puzzles about ping > implementation. > > (1) toybox uses unprivileged ICMP sockets to avoid unnecessary root > privilege. > However, it depends highly on kernel support. I can not use ping since my > kernle > is not linux and it does not support such usage.
I wrote it for (and tested it on) Linux. > (2) toybox uses unprivileged ICMP but does not set socket with flag > IP_HDRINCL. > So, it is impossible to get ttl info when gets reply from aim host since we > can > not get ip header. Currently toybox will print "ttl = 0". > I wonder if it is a balance of simple and feature. Nobody had asked for it before, IP_HDRINCL is a SOCK_RAW option, not a SOCK_DGRAM option. This ping is written using the less-privileged interface (so it doesn't have to run as root), which means we don't/can't create our own IP headers. Is there a way to receive the IP headers without having to generate them on output? A receive-only variant of IP_HDRINCL? > I assume there are some reasons I do not find. So, i just send a patch to fix > some trivial issues in ping.c. Hope someone can solve my puzzles. I wrote enough to get it to do what I wanted and moved on. You want it to do more. If you want to extend it, I'm interested. Rob _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
