Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Mar 2013 19:18:17 +0100
From:      Kajetan Staszkiewicz <vegeta@tuxpowered.net>
To:        Ermal =?iso-8859-1?q?Lu=E7i?= <eri@freebsd.org>
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>, "freebsd-pf@freebsd.org" <freebsd-pf@freebsd.org>
Subject:   Re: [patch] Source entries removing is awfully slow.
Message-ID:  <201303171918.17512.vegeta@tuxpowered.net>
In-Reply-To: <201303131651.03250.vegeta@tuxpowered.net>
References:  <201303081419.17743.vegeta@tuxpowered.net> <201303111751.18274.vegeta@tuxpowered.net> <201303131651.03250.vegeta@tuxpowered.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

I think I have the answer.

1. Some traffic creates a nat src node and some states.
2. Those states are properly linked to src_node->state_list, each has a proper
   pointer to nat_src_node.
3. At some point insertion of state (I do not for what reason) fails in this
   code:

3970         if (pf_state_insert(BOUND_IFACE(r, kif), skw, sks, s)) {
3971                 if (pd->proto == IPPROTO_TCP)
3972                         pf_normalize_tcp_cleanup(s);
3973                 REASON_SET(&reason, PFRES_STATEINS);
3974                 pf_src_tree_remove_state(s);
3975                 STATE_DEC_COUNTERS(s);
3976 #ifdef __FreeBSD__
3977                 pool_put(&V_pf_state_pl, s);

This state already has nat_src_node properly pointing to the src node.

pf_src_tree_remove_state() is called:
- s->nat_src_node is not NULL
- TAILQ_EMPTY is false, as the src_node has a state_list containing some
  previously and properly created states
- TAILQ_REMOVE fails because state s is not in the list, s->srcnode_link is
  {NULL,NULL}, src_node->state_list's head gets broken, giving the result as in
  my previous post and kernel panic.

With calling TAILQ_INSERT_HEAD before any pf_src_tree_remove_state is 
potentally called, I have a kernel running stable since the last week.

-- 
| pozdrawiam / greetings | powered by Debian, CentOS and FreeBSD |
|  Kajetan Staszkiewicz  | jabber,email: vegeta()tuxpowered net  |
|        Vegeta          | www: http://vegeta.tuxpowered.net     |
`------------------------^---------------------------------------'



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303171918.17512.vegeta>