diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 1999-07-23 19:48:03 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 1999-07-23 19:48:03 +0000 |
commit | 37c689b0a036fca833e2858f9c2241ef644434b8 (patch) | |
tree | be9b281b092113cb2c2f357d78d681e869ec6ebd | |
parent | c8f08420587e97d8e537a9a23a659d29d2d6adeb (diff) |
fix -n to work with verbose mode. ipnat -nvf will now show the parsed rules
without processing them.
-rw-r--r-- | sbin/ipnat/ipnat.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sbin/ipnat/ipnat.c b/sbin/ipnat/ipnat.c index a388f3bbb34..87eb0557398 100644 --- a/sbin/ipnat/ipnat.c +++ b/sbin/ipnat/ipnat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipnat.c,v 1.29 1999/07/08 01:38:36 deraadt Exp $ */ +/* $OpenBSD: ipnat.c,v 1.30 1999/07/23 19:48:02 kjell 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.29 1999/07/08 01:38:36 deraadt Exp $"; +static const char rcsid[] = "@(#)$Id: ipnat.c,v 1.30 1999/07/23 19:48:02 kjell Exp $"; #endif @@ -941,14 +941,15 @@ int opts; if (*line) fprintf(stderr, "%d: syntax error in \"%s\"\n", linenum, line); - } else if (!(opts & OPT_NODO)) { - if ((opts & OPT_VERBOSE) && np) - printnat(np, opts & OPT_VERBOSE, NULL); - if (opts & OPT_REM) { - if (ioctl(fd, SIOCADNAT, np) == -1) - perror("ioctl(SIOCADNAT)"); - } else if (ioctl(fd, SIOCRMNAT, np) == -1) - perror("ioctl(SIOCRMNAT)"); + } else if ((opts & OPT_VERBOSE) && np) { + printnat(np, opts & OPT_VERBOSE, NULL); + if (!(opts & OPT_NODO)) { + if (opts & OPT_REM) { + if (ioctl(fd, SIOCADNAT, np) == -1) + perror("ioctl(SIOCADNAT)"); + } else if (ioctl(fd, SIOCRMNAT, np) == -1) + perror("ioctl(SIOCRMNAT)"); + } } linenum++; } |