summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-01-23 02:24:13 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-01-23 02:24:13 +0000
commit908bc80fc3dde3e6dcf859b56741d959853a0c30 (patch)
tree56e39e7eb321b3d4967ef95a50d68be23cb7568f
parent54e32e8f038292fdc6fb22fd5e37d89871a919a0 (diff)
set default proto earlier enough so service names may be used as well;
report & fix by millert@.
-rw-r--r--sbin/ipnat/natparse.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sbin/ipnat/natparse.c b/sbin/ipnat/natparse.c
index 5836f260d03..fe7716983e0 100644
--- a/sbin/ipnat/natparse.c
+++ b/sbin/ipnat/natparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: natparse.c,v 1.7 2001/01/17 05:01:01 fgsch Exp $ */
+/* $OpenBSD: natparse.c,v 1.8 2001/01/23 02:24:12 fgsch Exp $ */
/*
* Copyright (C) 1993-2000 by Darren Reed.
@@ -318,6 +318,10 @@ int linenum;
return NULL;
}
+ /* TCP only by default */
+ ipn.in_flags |= IPN_TCP;
+ proto = "tcp";
+
cpp++;
strncpy(ipn.in_ifname, *cpp, sizeof(ipn.in_ifname) - 1);
@@ -596,10 +600,8 @@ int linenum;
return NULL;
} else if (genmask("255.255.255.255", (u_32_t *)&ipn.in_inmsk))
return NULL;
- if (!*cpp) {
- ipn.in_flags |= IPN_TCP; /* XXX- TCP only by default */
- proto = "tcp";
- } else {
+ if (*cpp) {
+ ipn.in_flags &= ~IPN_TCP; /* override default */
if (!strcasecmp(*cpp, "tcp"))
ipn.in_flags |= IPN_TCP;
else if (!strcasecmp(*cpp, "udp"))