static int destroy_sibling_or_exp(struct vrf* vrf, const struct nf_conntrack_tuple *t) { struct nf_conntrack_tuple_hash *h; struct nf_conntrack_expect *exp; struct nf_conn *sibling; DEBUGP("trying to timeout ct or exp for tuple "); NF_CT_DUMP_TUPLE(t); h = nf_conntrack_find_get(vrf, t, NULL, 0); if (h) { sibling = nf_ct_tuplehash_to_ctrack(h); DEBUGP("setting timeout of conntrack %p to 0\n", sibling); sibling->proto.gre.timeout = 0; sibling->proto.gre.stream_timeout = 0; nf_ct_put(sibling); return 1; } else { exp = nf_conntrack_expect_find_get(vrf,t); if (exp) { DEBUGP("unexpect_related of expect %p\n", exp); nf_conntrack_unexpect_related(exp); nf_conntrack_expect_put(exp); return 1; } } return 0; }
static int destroy_sibling_or_exp(const struct nf_conntrack_tuple *t) { struct nf_conntrack_tuple_hash *h; struct nf_conntrack_expect *exp; struct nf_conn *sibling; pr_debug("trying to timeout ct or exp for tuple "); NF_CT_DUMP_TUPLE(t); h = nf_conntrack_find_get(t); if (h) { sibling = nf_ct_tuplehash_to_ctrack(h); pr_debug("setting timeout of conntrack %p to 0\n", sibling); sibling->proto.gre.timeout = 0; sibling->proto.gre.stream_timeout = 0; if (del_timer(&sibling->timeout)) sibling->timeout.function((unsigned long)sibling); nf_ct_put(sibling); return 1; } else { exp = nf_conntrack_expect_find_get(t); if (exp) { pr_debug("unexpect_related of expect %p\n", exp); nf_conntrack_unexpect_related(exp); nf_conntrack_expect_put(exp); return 1; } } return 0; }
static void pptp_expectfn(struct nf_conn *ct, struct nf_conntrack_expect *exp) { struct vrf *vrf = nf_ct_vrf(ct); typeof(nf_nat_pptp_hook_expectfn) nf_nat_pptp_expectfn; DEBUGP("increasing timeouts\n"); /* increase timeout of GRE data channel conntrack entry */ ct->proto.gre.timeout = PPTP_GRE_TIMEOUT; ct->proto.gre.stream_timeout = PPTP_GRE_STREAM_TIMEOUT; /* Can you see how rusty this code is, compared with the pre-2.6.11 * one? That's what happened to my shiny newnat of 2002 ;( -HW */ rcu_read_lock(); nf_nat_pptp_expectfn = rcu_dereference(nf_nat_pptp_hook_expectfn); if (nf_nat_pptp_expectfn && ct->master->status & IPS_NAT_MASK) nf_nat_pptp_expectfn(ct, exp); else { struct nf_conntrack_tuple inv_t; struct nf_conntrack_expect *exp_other; /* obviously this tuple inversion only works until you do NAT */ nf_ct_invert_tuplepr(&inv_t, &exp->tuple); DEBUGP("trying to unexpect other dir: "); NF_CT_DUMP_TUPLE(&inv_t); exp_other = nf_conntrack_expect_find_get(vrf, &inv_t); if (exp_other) { /* delete other expectation. */ DEBUGP("found\n"); nf_conntrack_unexpect_related(exp_other); nf_conntrack_expect_put(exp_other); } else { DEBUGP("not found\n"); } } rcu_read_unlock(); }