#include <linux/proc_fs.h>
#include <linux/vmalloc.h>
#include <net/checksum.h>
-#include <net/ip.h>
#include <linux/stddef.h>
#include <linux/sysctl.h>
#include <linux/slab.h>
destroy_expect(struct ip_conntrack_expect *exp)
{
DEBUGP("destroy_expect(%p) use=%d\n", exp, atomic_read(&exp->use));
- IP_NF_ASSERT(atomic_read(&exp->use) == 0);
+ IP_NF_ASSERT(atomic_read(&exp->use));
IP_NF_ASSERT(!timer_pending(&exp->timeout));
kfree(exp);
}
+
inline void ip_conntrack_expect_put(struct ip_conntrack_expect *exp)
{
IP_NF_ASSERT(exp);
conntrack->ct_general.destroy = destroy_conntrack;
conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *tuple;
conntrack->tuplehash[IP_CT_DIR_ORIGINAL].ctrack = conntrack;
- conntrack->xid[IP_CT_DIR_ORIGINAL] = -1;
conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = repl_tuple;
conntrack->tuplehash[IP_CT_DIR_REPLY].ctrack = conntrack;
- conntrack->xid[IP_CT_DIR_REPLY] = -1;
for (i=0; i < IP_CT_NUMBER; i++)
conntrack->infos[i].master = &conntrack->ct_general;
DEBUGP("conntrack: expectation arrives ct=%p exp=%p\n",
conntrack, expected);
/* Welcome, Mr. Bond. We've been expecting you... */
+ IP_NF_ASSERT(master_ct(conntrack));
__set_bit(IPS_EXPECTED_BIT, &conntrack->status);
conntrack->master = expected;
expected->sibling = conntrack;
atomic_set(&new->use, 1);
/* add to expected list for this connection */
- list_add_tail(&new->expected_list, &related_to->sibling_list);
+ list_add(&new->expected_list, &related_to->sibling_list);
/* add to global list of expectations */
+
list_prepend(&ip_conntrack_expect_list, &new->list);
/* add and start timer if required */
if (related_to->helper->timeout) {
} else if (related_to->helper->max_expected &&
related_to->expecting >= related_to->helper->max_expected) {
+ struct list_head *cur_item;
/* old == NULL */
if (!(related_to->helper->flags &
IP_CT_HELPER_F_REUSE_EXPECT)) {
NIPQUAD(related_to->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip));
/* choose the the oldest expectation to evict */
- list_for_each_entry(old, &related_to->sibling_list,
- expected_list)
- if (old->sibling == NULL)
+ list_for_each(cur_item, &related_to->sibling_list) {
+ struct ip_conntrack_expect *cur;
+
+ cur = list_entry(cur_item,
+ struct ip_conntrack_expect,
+ expected_list);
+ if (cur->sibling == NULL) {
+ old = cur;
break;
+ }
+ }
- /* We cannot fail since related_to->expecting is the number
- * of unconfirmed expectations */
- IP_NF_ASSERT(old && old->sibling == NULL);
+ /* (!old) cannot happen, since related_to->expecting is the
+ * number of unconfirmed expects */
+ IP_NF_ASSERT(old);
/* newnat14 does not reuse the real allocated memory
* structures but rather unexpects the old and