diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-03-31 11:30:08 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-03-31 11:30:08 +0000 |
commit | 469d43cb7a9190fe2d4d57643ac9ba313d65bfd4 (patch) | |
tree | 2fdbdb4f97c1b2e6ab7e37528b91949b5f7f194b | |
parent | 730b5d3f465d2b4a26bd777a3c3c7844473cf5cb (diff) | |
download | busybox-w32-469d43cb7a9190fe2d4d57643ac9ba313d65bfd4.tar.gz busybox-w32-469d43cb7a9190fe2d4d57643ac9ba313d65bfd4.tar.bz2 busybox-w32-469d43cb7a9190fe2d4d57643ac9ba313d65bfd4.zip |
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
git-svn-id: svn://busybox.net/trunk/busybox@8675 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | networking/ifconfig.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index b884ef7c3..4e3df2982 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * Foundation; either version 2 of the License, or (at | 15 | * Foundation; either version 2 of the License, or (at |
16 | * your option) any later version. | 16 | * your option) any later version. |
17 | * | 17 | * |
18 | * $Id: ifconfig.c,v 1.29 2004/03/15 08:28:48 andersen Exp $ | 18 | * $Id: ifconfig.c,v 1.30 2004/03/31 11:30:08 andersen Exp $ |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
@@ -37,6 +37,7 @@ | |||
37 | #include <string.h> /* strcmp and friends */ | 37 | #include <string.h> /* strcmp and friends */ |
38 | #include <ctype.h> /* isdigit and friends */ | 38 | #include <ctype.h> /* isdigit and friends */ |
39 | #include <stddef.h> /* offsetof */ | 39 | #include <stddef.h> /* offsetof */ |
40 | #include <netdb.h> | ||
40 | #include <sys/ioctl.h> | 41 | #include <sys/ioctl.h> |
41 | #include <net/if.h> | 42 | #include <net/if.h> |
42 | #include <net/if_arp.h> | 43 | #include <net/if_arp.h> |
@@ -443,8 +444,13 @@ int ifconfig_main(int argc, char **argv) | |||
443 | #endif | 444 | #endif |
444 | } else if (inet_aton(host, &sai.sin_addr) == 0) { | 445 | } else if (inet_aton(host, &sai.sin_addr) == 0) { |
445 | /* It's not a dotted quad. */ | 446 | /* It's not a dotted quad. */ |
446 | ++goterr; | 447 | struct hostent *hp; |
447 | continue; | 448 | if ((hp = gethostbyname(host)) == (struct hostent *)NULL) { |
449 | ++goterr; | ||
450 | continue; | ||
451 | } | ||
452 | memcpy((char *) &sai.sin_addr, (char *) hp->h_addr_list[0], | ||
453 | sizeof(struct in_addr)); | ||
448 | } | 454 | } |
449 | #ifdef CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS | 455 | #ifdef CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS |
450 | if (mask & A_HOSTNAME) { | 456 | if (mask & A_HOSTNAME) { |