From 45185d600bccff75c24b3fde89e16836acacd32d Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Sun, 22 Nov 2009 22:34:51 +0000 Subject: cleanup after the NAT changes. we used to have multiple rulesets (scrub, NAT, filter). now we only have one. no need for an array any more. simplifies the code quite a bit. in the process fix the abuse of PF_RULESET_* by (surprise, isn't it) the table code. written at the filesystem hackathon in stockholm, committed from the hardware hackathon in portugal. ok gcc and jsing --- sbin/pfctl/parse.y | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'sbin/pfctl/parse.y') diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index ee20d3bd532..e3606d331f4 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.574 2009/11/09 14:31:58 jsg Exp $ */ +/* $OpenBSD: parse.y,v 1.575 2009/11/22 22:34:50 henning Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -5425,23 +5425,17 @@ symget(const char *nam) void mv_rules(struct pf_ruleset *src, struct pf_ruleset *dst) { - int i; struct pf_rule *r; - for (i = 0; i < PF_RULESET_MAX; ++i) { - while ((r = TAILQ_FIRST(src->rules[i].active.ptr)) - != NULL) { - TAILQ_REMOVE(src->rules[i].active.ptr, r, entries); - TAILQ_INSERT_TAIL(dst->rules[i].active.ptr, r, entries); - dst->anchor->match++; - } - src->anchor->match = 0; - while ((r = TAILQ_FIRST(src->rules[i].inactive.ptr)) - != NULL) { - TAILQ_REMOVE(src->rules[i].inactive.ptr, r, entries); - TAILQ_INSERT_TAIL(dst->rules[i].inactive.ptr, - r, entries); - } + while ((r = TAILQ_FIRST(src->rules.active.ptr)) != NULL) { + TAILQ_REMOVE(src->rules.active.ptr, r, entries); + TAILQ_INSERT_TAIL(dst->rules.active.ptr, r, entries); + dst->anchor->match++; + } + src->anchor->match = 0; + while ((r = TAILQ_FIRST(src->rules.inactive.ptr)) != NULL) { + TAILQ_REMOVE(src->rules.inactive.ptr, r, entries); + TAILQ_INSERT_TAIL(dst->rules.inactive.ptr, r, entries); } } -- cgit v1.2.3