From 908bc80fc3dde3e6dcf859b56741d959853a0c30 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Tue, 23 Jan 2001 02:24:13 +0000 Subject: set default proto earlier enough so service names may be used as well; report & fix by millert@. --- sbin/ipnat/natparse.c | 12 +++++++----- 1 file 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")) -- cgit v1.2.3