Return correct value from "set loopback".

Output "set ?filter deny host|port" rules correctly
with show ?filter.
Submitted by:	Dave Bodenstab <imdave@mcs.net>
This commit is contained in:
Brian Somers 1997-11-12 18:47:30 +00:00
parent 6143f398f8
commit c40e02e7f3
2 changed files with 15 additions and 5 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.99 1997/11/12 02:10:05 brian Exp $
* $Id: command.c,v 1.100 1997/11/12 16:34:50 brian Exp $
*
*/
#include <sys/param.h>
@ -183,10 +183,14 @@ static int
SetLoopback(struct cmdtab const * cmdlist, int argc, char **argv)
{
if (argc == 1)
if (!strcasecmp(*argv, "on"))
if (!strcasecmp(*argv, "on")) {
VarLoopback = 1;
else if (!strcasecmp(*argv, "off"))
return 0;
}
else if (!strcasecmp(*argv, "off")) {
VarLoopback = 0;
return 0;
}
return -1;
}

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: filter.c,v 1.16 1997/10/26 01:02:34 brian Exp $
* $Id: filter.c,v 1.17 1997/11/09 14:18:38 brian Exp $
*
* TODO: Shoud send ICMP error message when we discard packets.
*/
@ -434,7 +434,13 @@ ShowFilter(struct filterent * fp)
for (n = 0; n < MAXFILTERS; n++, fp++) {
if (fp->action != A_NONE) {
fprintf(VarTerm, "%2d %s", n, actname[fp->action]);
fprintf(VarTerm, "%2d %s", n, actname[fp->action & (A_PERMIT|A_DENY)]);
if (fp->action & A_UHOST)
fprintf(VarTerm, "host ");
else if (fp->action & A_UPORT)
fprintf(VarTerm, "port ");
else
fprintf(VarTerm, " ");
fprintf(VarTerm, "%s/%d ", inet_ntoa(fp->saddr), fp->swidth);
fprintf(VarTerm, "%s/%d ", inet_ntoa(fp->daddr), fp->dwidth);
if (fp->proto) {