summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorKurt Miller <kurt@cvs.openbsd.org>2007-07-10 15:58:38 +0000
committerKurt Miller <kurt@cvs.openbsd.org>2007-07-10 15:58:38 +0000
commitb292e9e15cf6dd283366923490011c293058cb1a (patch)
treea96d1b0ec70b0a20ca4e89ff4d673db6feb43090 /sys/net
parent84e50e8c46771626daba1b20e00786cfa4c26810 (diff)
adjust pf_find_state_all() so that it works correctly for the new global
table/state tail queue design. corrects ftp-proxy errors "server lookup failed (no rdr?)" okay henning@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pf.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 8265164fda7..98dca461f27 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.549 2007/07/04 08:14:14 mpf Exp $ */
+/* $OpenBSD: pf.c,v 1.550 2007/07/10 15:58:37 kurt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -560,43 +560,31 @@ pf_find_state_all(struct pf_state_key_cmp *key, u_int8_t tree, int *more)
{
struct pf_state_key *sk;
struct pf_state *s, *ret = NULL;
- struct pfi_kif *kif;
pf_status.fcounters[FCNT_STATE_SEARCH]++;
switch (tree) {
case PF_LAN_EXT:
- TAILQ_FOREACH(kif, &pfi_statehead, pfik_w_states) {
- sk = RB_FIND(pf_state_tree_lan_ext,
- &pf_statetbl_lan_ext, (struct pf_state_key *)key);
- if (sk == NULL)
- continue;
- ret = TAILQ_FIRST(&sk->states);
- if (more == NULL)
- return (ret);
- else
- TAILQ_FOREACH(s, &sk->states, next)
- (*more)++;
- }
+ sk = RB_FIND(pf_state_tree_lan_ext,
+ &pf_statetbl_lan_ext, (struct pf_state_key *)key);
break;
case PF_EXT_GWY:
- TAILQ_FOREACH(kif, &pfi_statehead, pfik_w_states) {
- sk = RB_FIND(pf_state_tree_ext_gwy,
- &pf_statetbl_ext_gwy, (struct pf_state_key *)key);
- if (sk == NULL)
- continue;
- ret = TAILQ_FIRST(&sk->states);
- if (more == NULL)
- return (ret);
- else
- TAILQ_FOREACH(s, &sk->states, next)
- (*more)++;
- }
+ sk = RB_FIND(pf_state_tree_ext_gwy,
+ &pf_statetbl_ext_gwy, (struct pf_state_key *)key);
break;
default:
panic("pf_find_state_all");
}
+ if (sk != NULL) {
+ ret = TAILQ_FIRST(&sk->states);
+ if (more == NULL)
+ return (ret);
+
+ TAILQ_FOREACH(s, &sk->states, next)
+ (*more)++;
+ }
+
return (ret);
}