diff options
Diffstat (limited to 'sbin/ipfw/ipfw2.c')
-rw-r--r-- | sbin/ipfw/ipfw2.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 13e1df3..f88ce70 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4815,6 +4815,17 @@ table_handler(int ac, char *av[]) ent.value = 0; if (do_cmd(do_add ? IP_FW_TABLE_ADD : IP_FW_TABLE_DEL, &ent, sizeof(ent)) < 0) + /* If running silent, don't bomb out on these errors. */ + if (!(do_quiet && (errno == (do_add ? EEXIST : ESRCH)))) + err(EX_OSERR, "setsockopt(IP_FW_TABLE_%s)", + do_add ? "ADD" : "DEL"); + /* In silent mode, react to a failed add by deleting */ + if (do_add) + do_cmd(IP_FW_TABLE_DEL, &ent, sizeof(ent)); + if (do_cmd(IP_FW_TABLE_ADD, + &ent, sizeof(ent)) < 0) + err(EX_OSERR, + "setsockopt(IP_FW_TABLE_ADD)"); err(EX_OSERR, "setsockopt(IP_FW_TABLE_%s)", do_add ? "ADD" : "DEL"); } else if (_substrcmp(*av, "flush") == 0) { |