Lines Matching refs:exp

47 void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp,  in nf_ct_unlink_expect_report()  argument
50 struct nf_conn_help *master_help = nfct_help(exp->master); in nf_ct_unlink_expect_report()
51 struct net *net = nf_ct_exp_net(exp); in nf_ct_unlink_expect_report()
55 WARN_ON(timer_pending(&exp->timeout)); in nf_ct_unlink_expect_report()
57 hlist_del_rcu(&exp->hnode); in nf_ct_unlink_expect_report()
62 hlist_del_rcu(&exp->lnode); in nf_ct_unlink_expect_report()
63 master_help->expecting[exp->class]--; in nf_ct_unlink_expect_report()
65 nf_ct_expect_event_report(IPEXP_DESTROY, exp, portid, report); in nf_ct_unlink_expect_report()
66 nf_ct_expect_put(exp); in nf_ct_unlink_expect_report()
74 struct nf_conntrack_expect *exp = from_timer(exp, t, timeout); in nf_ct_expectation_timed_out() local
77 nf_ct_unlink_expect(exp); in nf_ct_expectation_timed_out()
79 nf_ct_expect_put(exp); in nf_ct_expectation_timed_out()
119 bool nf_ct_remove_expect(struct nf_conntrack_expect *exp) in nf_ct_remove_expect() argument
121 if (del_timer(&exp->timeout)) { in nf_ct_remove_expect()
122 nf_ct_unlink_expect(exp); in nf_ct_remove_expect()
123 nf_ct_expect_put(exp); in nf_ct_remove_expect()
177 struct nf_conntrack_expect *i, *exp = NULL; in nf_ct_find_expectation() local
187 exp = i; in nf_ct_find_expectation()
191 if (!exp) in nf_ct_find_expectation()
199 if (!nf_ct_is_confirmed(exp->master)) in nf_ct_find_expectation()
210 if (unlikely(nf_ct_is_dying(exp->master) || in nf_ct_find_expectation()
211 !refcount_inc_not_zero(&exp->master->ct_general.use))) in nf_ct_find_expectation()
214 if (exp->flags & NF_CT_EXPECT_PERMANENT || !unlink) { in nf_ct_find_expectation()
215 refcount_inc(&exp->use); in nf_ct_find_expectation()
216 return exp; in nf_ct_find_expectation()
217 } else if (del_timer(&exp->timeout)) { in nf_ct_find_expectation()
218 nf_ct_unlink_expect(exp); in nf_ct_find_expectation()
219 return exp; in nf_ct_find_expectation()
222 nf_ct_put(exp->master); in nf_ct_find_expectation()
231 struct nf_conntrack_expect *exp; in nf_ct_remove_expectations() local
239 hlist_for_each_entry_safe(exp, next, &help->expectations, lnode) { in nf_ct_remove_expectations()
240 nf_ct_remove_expect(exp); in nf_ct_remove_expectations()
287 void nf_ct_unexpect_related(struct nf_conntrack_expect *exp) in nf_ct_unexpect_related() argument
290 nf_ct_remove_expect(exp); in nf_ct_unexpect_related()
312 void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class, in nf_ct_expect_init() argument
325 exp->flags = 0; in nf_ct_expect_init()
326 exp->class = class; in nf_ct_expect_init()
327 exp->expectfn = NULL; in nf_ct_expect_init()
328 exp->helper = NULL; in nf_ct_expect_init()
329 exp->tuple.src.l3num = family; in nf_ct_expect_init()
330 exp->tuple.dst.protonum = proto; in nf_ct_expect_init()
333 memcpy(&exp->tuple.src.u3, saddr, len); in nf_ct_expect_init()
334 if (sizeof(exp->tuple.src.u3) > len) in nf_ct_expect_init()
336 memset((void *)&exp->tuple.src.u3 + len, 0x00, in nf_ct_expect_init()
337 sizeof(exp->tuple.src.u3) - len); in nf_ct_expect_init()
338 memset(&exp->mask.src.u3, 0xFF, len); in nf_ct_expect_init()
339 if (sizeof(exp->mask.src.u3) > len) in nf_ct_expect_init()
340 memset((void *)&exp->mask.src.u3 + len, 0x00, in nf_ct_expect_init()
341 sizeof(exp->mask.src.u3) - len); in nf_ct_expect_init()
343 memset(&exp->tuple.src.u3, 0x00, sizeof(exp->tuple.src.u3)); in nf_ct_expect_init()
344 memset(&exp->mask.src.u3, 0x00, sizeof(exp->mask.src.u3)); in nf_ct_expect_init()
348 exp->tuple.src.u.all = *src; in nf_ct_expect_init()
349 exp->mask.src.u.all = htons(0xFFFF); in nf_ct_expect_init()
351 exp->tuple.src.u.all = 0; in nf_ct_expect_init()
352 exp->mask.src.u.all = 0; in nf_ct_expect_init()
355 memcpy(&exp->tuple.dst.u3, daddr, len); in nf_ct_expect_init()
356 if (sizeof(exp->tuple.dst.u3) > len) in nf_ct_expect_init()
358 memset((void *)&exp->tuple.dst.u3 + len, 0x00, in nf_ct_expect_init()
359 sizeof(exp->tuple.dst.u3) - len); in nf_ct_expect_init()
361 exp->tuple.dst.u.all = *dst; in nf_ct_expect_init()
364 memset(&exp->saved_addr, 0, sizeof(exp->saved_addr)); in nf_ct_expect_init()
365 memset(&exp->saved_proto, 0, sizeof(exp->saved_proto)); in nf_ct_expect_init()
372 struct nf_conntrack_expect *exp; in nf_ct_expect_free_rcu() local
374 exp = container_of(head, struct nf_conntrack_expect, rcu); in nf_ct_expect_free_rcu()
375 kmem_cache_free(nf_ct_expect_cachep, exp); in nf_ct_expect_free_rcu()
378 void nf_ct_expect_put(struct nf_conntrack_expect *exp) in nf_ct_expect_put() argument
380 if (refcount_dec_and_test(&exp->use)) in nf_ct_expect_put()
381 call_rcu(&exp->rcu, nf_ct_expect_free_rcu); in nf_ct_expect_put()
385 static void nf_ct_expect_insert(struct nf_conntrack_expect *exp) in nf_ct_expect_insert() argument
388 struct nf_conn_help *master_help = nfct_help(exp->master); in nf_ct_expect_insert()
390 struct net *net = nf_ct_exp_net(exp); in nf_ct_expect_insert()
391 unsigned int h = nf_ct_expect_dst_hash(net, &exp->tuple); in nf_ct_expect_insert()
394 refcount_add(2, &exp->use); in nf_ct_expect_insert()
396 timer_setup(&exp->timeout, nf_ct_expectation_timed_out, 0); in nf_ct_expect_insert()
400 exp->timeout.expires = jiffies + in nf_ct_expect_insert()
401 helper->expect_policy[exp->class].timeout * HZ; in nf_ct_expect_insert()
403 add_timer(&exp->timeout); in nf_ct_expect_insert()
405 hlist_add_head_rcu(&exp->lnode, &master_help->expectations); in nf_ct_expect_insert()
406 master_help->expecting[exp->class]++; in nf_ct_expect_insert()
408 hlist_add_head_rcu(&exp->hnode, &nf_ct_expect_hash[h]); in nf_ct_expect_insert()
420 struct nf_conntrack_expect *exp, *last = NULL; in evict_oldest_expect() local
422 hlist_for_each_entry(exp, &master_help->expectations, lnode) { in evict_oldest_expect()
423 if (exp->class == new->class) in evict_oldest_expect()
424 last = exp; in evict_oldest_expect()
513 struct nf_conntrack_expect *exp; in nf_ct_expect_iterate_destroy() local
520 hlist_for_each_entry_safe(exp, next, in nf_ct_expect_iterate_destroy()
523 if (iter(exp, data) && del_timer(&exp->timeout)) { in nf_ct_expect_iterate_destroy()
524 nf_ct_unlink_expect(exp); in nf_ct_expect_iterate_destroy()
525 nf_ct_expect_put(exp); in nf_ct_expect_iterate_destroy()
539 struct nf_conntrack_expect *exp; in nf_ct_expect_iterate_net() local
546 hlist_for_each_entry_safe(exp, next, in nf_ct_expect_iterate_net()
550 if (!net_eq(nf_ct_exp_net(exp), net)) in nf_ct_expect_iterate_net()
553 if (iter(exp, data) && del_timer(&exp->timeout)) { in nf_ct_expect_iterate_net()
554 nf_ct_unlink_expect_report(exp, portid, report); in nf_ct_expect_iterate_net()
555 nf_ct_expect_put(exp); in nf_ct_expect_iterate_net()