aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-03-31 11:30:08 +0000
committerEric Andersen <andersen@codepoet.org>2004-03-31 11:30:08 +0000
commitc11a6a887b82e4c1f51e18499b06c0d745771ab0 (patch)
tree2fdbdb4f97c1b2e6ab7e37528b91949b5f7f194b /networking
parent11e5516d6756b8594e3e6fcff2e661b6141c5ab7 (diff)
downloadbusybox-c11a6a887b82e4c1f51e18499b06c0d745771ab0.tar.gz
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
Diffstat (limited to 'networking')
-rw-r--r--networking/ifconfig.c12
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 @@
* Foundation; either version 2 of the License, or (at
* your option) any later version.
*
- * $Id: ifconfig.c,v 1.29 2004/03/15 08:28:48 andersen Exp $
+ * $Id: ifconfig.c,v 1.30 2004/03/31 11:30:08 andersen Exp $
*
*/
@@ -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 @@ int ifconfig_main(int argc, char **argv)
#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) {