summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1999-06-03 17:53:11 +0000
committerderaadt <deraadt@openbsd.org>1999-06-03 17:53:11 +0000
commit4c8ba35dddfbc748ba0734ab6bbc87a055cf7a62 (patch)
tree5e7ca9aff0775f424e977175b05428e230ea85eb
parentsync (diff)
downloadwireguard-openbsd-4c8ba35dddfbc748ba0734ab6bbc87a055cf7a62.tar.xz
wireguard-openbsd-4c8ba35dddfbc748ba0734ab6bbc87a055cf7a62.zip
check for interface names before hostnames
-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;