From owner-freebsd-pf@FreeBSD.ORG Fri Apr 28 10:53:49 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 6900016A400; Fri, 28 Apr 2006 10:53:49 +0000 (UTC) (envelope-from dhartmei@insomnia.benzedrine.cx) Received: from insomnia.benzedrine.cx (insomnia.benzedrine.cx [62.65.145.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9803D43D45; Fri, 28 Apr 2006 10:53:48 +0000 (GMT) (envelope-from dhartmei@insomnia.benzedrine.cx) Received: from insomnia.benzedrine.cx (dhartmei@localhost [127.0.0.1]) by insomnia.benzedrine.cx (8.13.4/8.13.4) with ESMTP id k3SArkB7020904 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Fri, 28 Apr 2006 12:53:46 +0200 (MEST) Received: (from dhartmei@localhost) by insomnia.benzedrine.cx (8.13.4/8.12.10/Submit) id k3SArkEN026013; Fri, 28 Apr 2006 12:53:46 +0200 (MEST) Date: Fri, 28 Apr 2006 12:53:45 +0200 From: Daniel Hartmeier To: Boris Polevoy Message-ID: <20060428105345.GM19449@insomnia.benzedrine.cx> References: <20060428103529.GL19449@insomnia.benzedrine.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060428103529.GL19449@insomnia.benzedrine.cx> User-Agent: Mutt/1.5.10i Cc: mlaier@freebsd.org, pf@benzedrine.cx, freebsd-pf@freebsd.org Subject: Re: PF with subanchors possible bug 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: Fri, 28 Apr 2006 10:53:49 -0000 The second bug is is userland pfctl, I suggest Index: parse.y =================================================================== RCS file: /cvs/src/sbin/pfctl/parse.y,v retrieving revision 1.496 diff -u -r1.496 parse.y --- parse.y 6 Apr 2006 21:54:56 -0000 1.496 +++ parse.y 28 Apr 2006 10:54:52 -0000 @@ -733,7 +733,7 @@ loadrule : LOAD ANCHOR string FROM string { struct loadanchors *loadanchor; - if (strlen($3) >= MAXPATHLEN) { + if (strlen(pf->anchor) + 1 + strlen($3) >= MAXPATHLEN) { yyerror("anchorname %s too long, max %u\n", $3, MAXPATHLEN - 1); free($3); @@ -742,8 +742,13 @@ loadanchor = calloc(1, sizeof(struct loadanchors)); if (loadanchor == NULL) err(1, "loadrule: calloc"); - if ((loadanchor->anchorname = strdup($3)) == NULL) - err(1, "loadrule: strdup"); + if ((loadanchor->anchorname = malloc(MAXPATHLEN)) == NULL) + err(1, "loadrule: malloc"); + if (pf->anchor[0]) + snprintf(loadanchor->anchorname, MAXPATHLEN, "%s/%s", + pf->anchor, $3); + else + strlcpy(loadanchor->anchorname, $3, MAXPATHLEN); if ((loadanchor->filename = strdup($5)) == NULL) err(1, "loadrule: strdup"); With both this and your patch applied, your example behaves as I expect it should. I hope you agree ;) Daniel