Comments on recent patches.

Rob Landley rob at landley.net
Sat Sep 2 17:17:50 UTC 2006


Nice cleanups.  (Thanks for tackling bugs.busybox.net, I just haven't had time 
for it...)

Couple of comments on 16029:

+       if (sourceaddr.sin_addr.s_addr) {
+               if (bind(pingsock, (struct sockaddr*)&sourceaddr, 
sizeof(sourceaddr)) == -1)
+                       bb_error_msg_and_die("could not bind to address");
+       }
+

I believe you can replace most of the above with xbind() (It's a fairly recent 
addition to libbb/xfuncs.c.)

I thought the library already does parse_nipquad(), doesn't gethostbyaddr() 
cover it?  Also, gethostbyname() should automatically parse ##.##.##.## 
notation without bouncing off a DNS server, and the code already uses that.  
(I believe it calls gethostbyaddr() internally, but I haven't looked at the 
library implementation.)

Going in the other direction, another repetition of "%u.%u.%u.%u" was in the 
CIFS patch to mount I just merged.  The comment on that was it doesn't 
support ipv6.  I really haven't looked into ipv6, other than an idle 
curiosity about whether it's possible to merge ping and ping6.  (I honestly 
don't know.  I live in the united states, which claimed most of the ipv4 
addresses back when it invented the thing, and thus has yet to actually need 
ipv6 for anything.  Thus poking at ipv6 is way down on my todo list...)

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list