[BusyBox-cvs] busybox/networking ifconfig.c,1.29,1.30
Erik Andersen
andersen at busybox.net
Wed Mar 31 11:30:11 UTC 2004
Update of /var/cvs/busybox/networking
In directory nail:/tmp/cvs-serv26619/networking
Modified Files:
ifconfig.c
Log Message:
Patch from Thomas Winkler:
ifconfig did not look up hostnames, so
ifconfig lo localhost
would not work, you have to do
ifconfig lo 127.0.0.1
Index: ifconfig.c
===================================================================
RCS file: /var/cvs/busybox/networking/ifconfig.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- a/ifconfig.c 15 Mar 2004 08:28:48 -0000 1.29
+++ b/ifconfig.c 31 Mar 2004 11:30:08 -0000 1.30
@@ -37,6 +37,7 @@
#include <string.h> /* strcmp and friends */
#include <ctype.h> /* isdigit and friends */
#include <stddef.h> /* offsetof */
+#include <netdb.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_arp.h>
@@ -443,8 +444,13 @@
#endif
} else if (inet_aton(host, &sai.sin_addr) == 0) {
/* It's not a dotted quad. */
- ++goterr;
- continue;
+ struct hostent *hp;
+ if ((hp = gethostbyname(host)) == (struct hostent *)NULL) {
+ ++goterr;
+ continue;
+ }
+ memcpy((char *) &sai.sin_addr, (char *) hp->h_addr_list[0],
+ sizeof(struct in_addr));
}
#ifdef CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS
if (mask & A_HOSTNAME) {
More information about the busybox-cvs
mailing list