diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-06-03 17:53:12 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-06-03 17:53:12 +0000 |
commit | f8ffd3087000a03a6e2574e9dbd43d4cbe69bb2a (patch) | |
tree | 693ba3b1f737c6391680f60349594375d807c791 /sbin/ipnat/ipnat.c | |
parent | bcc431d8362a02344d4106821bfae84d8ad4a5c4 (diff) |
check for interface names before hostnames
Diffstat (limited to 'sbin/ipnat/ipnat.c')
-rw-r--r-- | sbin/ipnat/ipnat.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sbin/ipnat/ipnat.c b/sbin/ipnat/ipnat.c index 29bdf05a653..ac8ee00fd16 100644 --- a/sbin/ipnat/ipnat.c +++ b/sbin/ipnat/ipnat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipnat.c,v 1.26 1999/02/05 05:58:48 deraadt Exp $ */ +/* $OpenBSD: ipnat.c,v 1.27 1999/06/03 17:53:11 deraadt Exp $ */ /* * Copyright (C) 1993-1998 by Darren Reed. * @@ -67,7 +67,7 @@ extern char *sys_errlist[]; #if !defined(lint) static const char sccsid[] ="@(#)ipnat.c 1.9 6/5/96 (C) 1993 Darren Reed"; -static const char rcsid[] = "@(#)$Id: ipnat.c,v 1.26 1999/02/05 05:58:48 deraadt Exp $"; +static const char rcsid[] = "@(#)$Id: ipnat.c,v 1.27 1999/06/03 17:53:11 deraadt Exp $"; #endif @@ -599,13 +599,13 @@ int *resolved; if (isdigit(*host)) return inet_addr(host); - if (!(hp = gethostbyname(host))) { - if (!(np = getnetbyname(host))) { #if defined(__OpenBSD__) - /* attempt a map from interface name to address */ - if ((addr = if_addr(host)) != INADDR_NONE) - return addr; + /* attempt a map from interface name to address */ + if ((addr = if_addr(host)) != INADDR_NONE) + return addr; #endif + if (!(hp = gethostbyname(host))) { + if (!(np = getnetbyname(host))) { *resolved = -1; fprintf(stderr, "can't resolve hostname: %s\n", host); return 0; |