diff options
-rw-r--r-- | sbin/ipfw/ipfw.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sbin/ipfw/ipfw.c b/sbin/ipfw/ipfw.c index 77e09b2..1af1c73 100644 --- a/sbin/ipfw/ipfw.c +++ b/sbin/ipfw/ipfw.c @@ -16,7 +16,7 @@ * * NEW command line interface for IP firewall facility * - * $Id: ipfw.c,v 1.48 1997/12/05 02:43:26 julian Exp $ + * $Id: ipfw.c,v 1.49 1997/12/26 03:24:26 alex Exp $ * */ @@ -713,6 +713,7 @@ delete(ac,av) { struct ip_fw rule; int i; + int failed = 0; memset(&rule, 0, sizeof rule); @@ -722,9 +723,13 @@ delete(ac,av) while (ac && isdigit(**av)) { rule.fw_number = atoi(*av); av++; ac--; i = setsockopt(s, IPPROTO_IP, IP_FW_DEL, &rule, sizeof rule); - if (i) - warn("setsockopt(%s)", "IP_FW_DEL"); + if (i) { + failed = 1; + warn("rule %u: setsockopt(%s)", rule.fw_number, "IP_FW_DEL"); + } } + if (failed) + exit(1); } static void @@ -1064,6 +1069,7 @@ zero (ac, av) printf("Accounting cleared.\n"); } else { struct ip_fw rule; + int failed = 0; memset(&rule, 0, sizeof rule); while (ac) { @@ -1071,14 +1077,19 @@ zero (ac, av) if (isdigit(**av)) { rule.fw_number = atoi(*av); av++; ac--; if (setsockopt(s, IPPROTO_IP, - IP_FW_ZERO, &rule, sizeof rule)) - warn("setsockopt(%s)", "IP_FW_ZERO"); + IP_FW_ZERO, &rule, sizeof rule)) { + warn("rule %u: setsockopt(%s)", rule.fw_number, + "IP_FW_ZERO"); + failed = 1; + } else printf("Entry %d cleared\n", rule.fw_number); } else show_usage("invalid rule number ``%s''", *av); } + if (failed) + exit(1); } } |