summaryrefslogtreecommitdiff
path: root/sbin/ipnat
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-06-03 17:53:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-06-03 17:53:12 +0000
commitf8ffd3087000a03a6e2574e9dbd43d4cbe69bb2a (patch)
tree693ba3b1f737c6391680f60349594375d807c791 /sbin/ipnat
parentbcc431d8362a02344d4106821bfae84d8ad4a5c4 (diff)
check for interface names before hostnames
Diffstat (limited to 'sbin/ipnat')
-rw-r--r--sbin/ipnat/ipnat.82
-rw-r--r--sbin/ipnat/ipnat.c14
2 files changed, 8 insertions, 8 deletions
diff --git a/sbin/ipnat/ipnat.8 b/sbin/ipnat/ipnat.8
index e8959ba4ba8..0ecf1e62018 100644
--- a/sbin/ipnat/ipnat.8
+++ b/sbin/ipnat/ipnat.8
@@ -108,7 +108,7 @@ Both
.Em internal
and
.Em external
-may be an actual IP address, a hostname, or the name of an interface. If it is
+may be an actual IP address, the name of an interface, or a hostname. If it is
a network number, however, a problem may arise. For example:
.Pp
.Bd -unfilled -offset indent -compact
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;