From owner-freebsd-pf@FreeBSD.ORG Mon May 29 20:38:01 2006 Return-Path: X-Original-To: freebsd-pf@freebsd.org Delivered-To: freebsd-pf@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5B36D16ACD4 for ; Mon, 29 May 2006 20:38:01 +0000 (UTC) (envelope-from pauamma@gundo.com) Received: from mail.gundo.com (javelin.gundo.com [216.36.125.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 450E143D73 for ; Mon, 29 May 2006 20:37:59 +0000 (GMT) (envelope-from pauamma@gundo.com) Received: by mail.gundo.com (Postfix, from userid 1054) id 740C4674FE; Mon, 29 May 2006 15:37:58 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by mail.gundo.com (Postfix) with ESMTP id 6D488674FC for ; Mon, 29 May 2006 15:37:58 -0500 (CDT) Date: Mon, 29 May 2006 15:37:58 -0500 (CDT) From: PauAmma To: freebsd-pf@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: Loading table data into pf at start-up X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 May 2006 20:38:02 -0000 /etc/rc.d/pf will happily let you load a rules file into pf, but unfortunately won't let you load table data if it doesn't fit on a single line or if you want to store table data in other files for any reason. pfctl only allows one -f option, so creative use of pf_flags won't help, so I added a configuration variable, pf_tables, and some extra logic in pf_start() to handle it. pf_tables is a space-separated list of action:table:file tuples, eg: pf_tables="a:idiots4:/etc/pf.idiots4 a:idiots6:/etc/pf.idiots6" For each tuple, my patched /etc/rc.d/pf runs: pfctl -T -t -f $pf_flags I tested that with /etc/rc.d/pf 1.3.2.2, and it works fine under 5.4-RELEASE-p14. If there's any interest, I can supply a patch against 1.3.2.2, or (if there's any interest) an untested patch against 1.12 (no -HEAD running here, so I can't test it). Suggestions/Comments/"Go file a PR" requests all welcome. (please cc me on list replies - I don't follow it regularly)