From owner-freebsd-bugs@FreeBSD.ORG Mon Jan 21 21:20:01 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7627B16A4CD for ; Mon, 21 Jan 2008 21:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 603D113C461 for ; Mon, 21 Jan 2008 21:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m0LLK1q6099257 for ; Mon, 21 Jan 2008 21:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m0LLK1mg099256; Mon, 21 Jan 2008 21:20:01 GMT (envelope-from gnats) Resent-Date: Mon, 21 Jan 2008 21:20:01 GMT Resent-Message-Id: <200801212120.m0LLK1mg099256@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Niki Denev Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0F1516A41B for ; Mon, 21 Jan 2008 21:16:10 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id EB1D513C45A for ; Mon, 21 Jan 2008 21:16:10 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m0LLEegR076143 for ; Mon, 21 Jan 2008 21:14:40 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m0LLEe5E076142; Mon, 21 Jan 2008 21:14:40 GMT (envelope-from nobody) Message-Id: <200801212114.m0LLEe5E076142@www.freebsd.org> Date: Mon, 21 Jan 2008 21:14:40 GMT From: Niki Denev To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/119874: "/etc/rc.d/pf reload" fails if there are macros defined in pf_flags rc variable X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jan 2008 21:20:01 -0000 >Number: 119874 >Category: misc >Synopsis: "/etc/rc.d/pf reload" fails if there are macros defined in pf_flags rc variable >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 21 21:20:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Niki Denev >Release: FreeBSD 7.0-PRERELEASE >Organization: >Environment: FreeBSD rtr1 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #1: Mon Jan 21 17:24:53 UTC 2008 root@rtr3:/usr/obj/usr/src/sys/RTR amd64 >Description: I'm using the pf_flags rc var to set macros for pf.conf files i use in redundant router configuration. This way i can have exactly the same pf.conf on all of the routers, and still set host specific options as "hostid" used by pfsync via rc.conf The problem is that when i use "/etc/rc.d/pf reload" to reload the rules, the rc.d/pf script first executes pfctl with -n option to check the pf.conf syntax, but fails to include the $pf_flags var, and fails because of undefined macros. >How-To-Repeat: use macros in pf.conf defined in rc.conf as pf_flags="-D macro=value" and then do # /etc/rc.d/pf reload and it will fail because when the rules are checked on reloading the $pf_flags variable is not included in the command. >Fix: Small patch to /etc/rc.d/pf which adds $pf_flags variable when executing pfctl with "-n" flag to check ruleset syntax. Patch attached with submission follows: --- /etc/rc.d/pf.orig 2008-01-21 11:18:27.000000000 +0200 +++ /etc/rc.d/pf 2008-01-21 11:29:56.000000000 +0200 @@ -50,7 +50,7 @@ pf_reload() { echo "Reloading pf rules." - $pf_program -n -f "$pf_rules" || return 1 + $pf_program -n -f "$pf_rules" $pf_flags || return 1 # Flush everything but existing state entries that way when # rules are read in, it doesn't break established connections. $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1 >Release-Note: >Audit-Trail: >Unformatted: