HomeFreeBSD

MFC r314111: Improve ipfw rule creation for blacklist-helper script

Description

MFC r314111: Improve ipfw rule creation for blacklist-helper script

When blocking an address, the blacklist-helper script
needs to do the following things for the ipfw packet
filter:

  • create a table to hold the addresses to be blocked, so lookups can be done quickly, and place the address to be blocked in that table
  • create rule that does the lookup in the table and blocks the packet

The ipfw system allows multiple rules to be inserted for
a given rule number. There only needs to be one rule
to do the lookup per port. Modify the script to probe
for the existence of the rule before attempting to create
it, so only one rule is inserted, rather than one rule per
blocked address.

PR: 214980
Reported by: azhegalov (at) gmail.com
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9681