summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/pfctl/parse.y13
-rw-r--r--sys/net/pf_table.c4
2 files changed, 11 insertions, 6 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 0db2fec3a08..26622df74e6 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.497 2006/05/01 12:24:32 dhartmei Exp $ */
+/* $OpenBSD: parse.y,v 1.498 2006/05/02 10:08:45 dhartmei Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -734,7 +734,7 @@ anchorrule : ANCHOR string dir interface af proto fromto filter_opts {
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);
@@ -743,8 +743,13 @@ loadrule : LOAD ANCHOR string FROM string {
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");
diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c
index ca6eb2aef55..a79ed372a44 100644
--- a/sys/net/pf_table.c
+++ b/sys/net/pf_table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_table.c,v 1.67 2005/08/02 12:40:42 pascoe Exp $ */
+/* $OpenBSD: pf_table.c,v 1.68 2006/05/02 10:08:45 dhartmei Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -2049,7 +2049,7 @@ pfr_attach_table(struct pf_ruleset *rs, char *name)
bzero(&tbl, sizeof(tbl));
strlcpy(tbl.pfrt_name, name, sizeof(tbl.pfrt_name));
if (ac != NULL)
- strlcpy(tbl.pfrt_anchor, ac->name, sizeof(tbl.pfrt_anchor));
+ strlcpy(tbl.pfrt_anchor, ac->path, sizeof(tbl.pfrt_anchor));
kt = pfr_lookup_table(&tbl);
if (kt == NULL) {
kt = pfr_create_ktable(&tbl, time_second, 1);