[BusyBox] nslookup and uClibc (was: uClibc build problems)

Goetz Bock bock at blacknet.de
Sun Jun 17 16:24:20 UTC 2001


On Sun, Jun 17 '01 at 18:03, Tom Cameron wrote:
>  Is this an easy fix?  Am I understanding you correctly in that _res needs
> to be added into resolv.h, or does an include need to be added?  Just
> wondering.  Otherwise, things work GREAT.
I'm afraid there is more magic in there than just adding the _res
structure.

I've attached a patch, that adds a new feature to Config.h and if
enabled removes all the fins other nameservers stuff from nslookup.c

    Goetz.

BTW: Hi to all. This is my first posting on the busybox list and I'm
     subscribed since about 10min.    
     I'm currently triiing to make my own "installion/rescue" CD for 
     Trustix Linux Blacknet Edition, and am using busybox there.
     bla ... bla ... bla ...
     Oh, busybox is a nice tool, thanks for all the work. 
-------------- next part --------------
--- busybox.old/Config.h	Thu May 24 16:11:09 2001
+++ busybox/Config.h	Mon Jun 18 00:07:13 2001
@@ -368,6 +368,10 @@
 //
 // Support for TELNET to pass TERM type to remote host.  Adds 384 bytes.
 #define BB_FEATURE_TELNET_TTYPE
+//
+// uClibc does not provide the _res structore needed by new nslookup
+// Enable this if you want to use nslookup with uClibc
+#define BB_FEATURE_BROKEN_RES
 //
 // End of Features List
 //
--- busybox.old/nslookup.c	Wed Jun 13 00:21:24 2001
+++ busybox/nslookup.c	Mon Jun 18 00:06:53 2001
@@ -31,8 +31,10 @@
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <netinet/in.h>
+#ifndef BB_FEATURE_BROKEN_RES
 #include <resolv.h>
 #include <arpa/inet.h>
+#endif
 #include "busybox.h"
 
 /*
@@ -128,6 +130,17 @@
 	return gethostbyaddr((char *) &addr, 4, AF_INET);	/* IPv4 only for now */
 }
 
+#ifdef BB_FEATURE_BROKEN_RES
+/* I have to see how the real nslookup does this.
+ * I could dig through /etc/resolv.conf, but is there a
+ * better (programatic) way?
+ */
+static inline void server_print(void)
+{
+	printf("Server:     %s\n", "default");
+	printf("Address:    %s\n\n", "default");
+}
+#else
 /* lookup the default nameserver and display it */
 static inline void server_print(void)
 {
@@ -137,6 +150,7 @@
 	hostent_fprint(gethostbyaddr_wrapper(ip));
 	printf("\n");
 }
+#endif
 
 /* naive function to check whether char *s is an ip address */
 static int is_ip_address(const char *s)
@@ -160,7 +174,9 @@
 		show_usage();
 	}
 
+#ifndef BB_FEATURE_BROKEN_RES
 	res_init();
+#endif    
 	server_print();
 	if (is_ip_address(argv[1])) {
 		host = gethostbyaddr_wrapper(argv[1]);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20010617/9a412768/attachment.pgp 


More information about the busybox mailing list