Lines Matching refs:ct
69 struct nf_conn *ct; member
157 static u32 ovs_ct_get_mark(const struct nf_conn *ct) in ovs_ct_get_mark() argument
160 return ct ? ct->mark : 0; in ovs_ct_get_mark()
171 static void ovs_ct_get_labels(const struct nf_conn *ct, in ovs_ct_get_labels() argument
174 struct nf_conn_labels *cl = ct ? nf_ct_labels_find(ct) : NULL; in ovs_ct_get_labels()
188 key->ct.orig_tp.src = htons(orig->dst.u.icmp.type); in __ovs_ct_update_key_orig_tp()
189 key->ct.orig_tp.dst = htons(orig->dst.u.icmp.code); in __ovs_ct_update_key_orig_tp()
191 key->ct.orig_tp.src = orig->src.u.all; in __ovs_ct_update_key_orig_tp()
192 key->ct.orig_tp.dst = orig->dst.u.all; in __ovs_ct_update_key_orig_tp()
198 const struct nf_conn *ct) in __ovs_ct_update_key() argument
202 key->ct.mark = ovs_ct_get_mark(ct); in __ovs_ct_update_key()
203 ovs_ct_get_labels(ct, &key->ct.labels); in __ovs_ct_update_key()
205 if (ct) { in __ovs_ct_update_key()
209 if (ct->master) in __ovs_ct_update_key()
210 ct = ct->master; in __ovs_ct_update_key()
211 orig = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple; in __ovs_ct_update_key()
215 nf_ct_l3num(ct) == NFPROTO_IPV4) { in __ovs_ct_update_key()
222 nf_ct_l3num(ct) == NFPROTO_IPV6) { in __ovs_ct_update_key()
247 struct nf_conn *ct; in ovs_ct_update_key() local
250 ct = nf_ct_get(skb, &ctinfo); in ovs_ct_update_key()
251 if (ct) { in ovs_ct_update_key()
254 if (!nf_ct_is_confirmed(ct)) in ovs_ct_update_key()
259 if (ct->master) in ovs_ct_update_key()
264 if (ct->status & IPS_SRC_NAT) in ovs_ct_update_key()
266 if (ct->status & IPS_DST_NAT) in ovs_ct_update_key()
269 zone = nf_ct_zone(ct); in ovs_ct_update_key()
275 __ovs_ct_update_key(key, state, zone, ct); in ovs_ct_update_key()
301 nla_put_u32(skb, OVS_KEY_ATTR_CT_MARK, output->ct.mark)) in ovs_ct_put_key()
305 nla_put(skb, OVS_KEY_ATTR_CT_LABELS, sizeof(output->ct.labels), in ovs_ct_put_key()
306 &output->ct.labels)) in ovs_ct_put_key()
314 output->ct.orig_tp.src, in ovs_ct_put_key()
315 output->ct.orig_tp.dst, in ovs_ct_put_key()
325 output->ct.orig_tp.src, in ovs_ct_put_key()
326 output->ct.orig_tp.dst, in ovs_ct_put_key()
338 static int ovs_ct_set_mark(struct nf_conn *ct, struct sw_flow_key *key, in ovs_ct_set_mark() argument
344 new_mark = ct_mark | (ct->mark & ~(mask)); in ovs_ct_set_mark()
345 if (ct->mark != new_mark) { in ovs_ct_set_mark()
346 ct->mark = new_mark; in ovs_ct_set_mark()
347 if (nf_ct_is_confirmed(ct)) in ovs_ct_set_mark()
348 nf_conntrack_event_cache(IPCT_MARK, ct); in ovs_ct_set_mark()
349 key->ct.mark = new_mark; in ovs_ct_set_mark()
358 static struct nf_conn_labels *ovs_ct_get_conn_labels(struct nf_conn *ct) in ovs_ct_get_conn_labels() argument
362 cl = nf_ct_labels_find(ct); in ovs_ct_get_conn_labels()
364 nf_ct_labels_ext_add(ct); in ovs_ct_get_conn_labels()
365 cl = nf_ct_labels_find(ct); in ovs_ct_get_conn_labels()
375 static int ovs_ct_init_labels(struct nf_conn *ct, struct sw_flow_key *key, in ovs_ct_init_labels() argument
383 master_cl = ct->master ? nf_ct_labels_find(ct->master) : NULL; in ovs_ct_init_labels()
388 cl = ovs_ct_get_conn_labels(ct); in ovs_ct_init_labels()
409 nf_conntrack_event_cache(IPCT_LABEL, ct); in ovs_ct_init_labels()
411 memcpy(&key->ct.labels, cl->bits, OVS_CT_LABELS_LEN); in ovs_ct_init_labels()
416 static int ovs_ct_set_labels(struct nf_conn *ct, struct sw_flow_key *key, in ovs_ct_set_labels() argument
423 cl = ovs_ct_get_conn_labels(ct); in ovs_ct_set_labels()
427 err = nf_connlabels_replace(ct, labels->ct_labels_32, in ovs_ct_set_labels()
433 memcpy(&key->ct.labels, cl->bits, OVS_CT_LABELS_LEN); in ovs_ct_set_labels()
445 struct nf_conn *ct; in ovs_ct_helper() local
448 ct = nf_ct_get(skb, &ctinfo); in ovs_ct_helper()
449 if (!ct || ctinfo == IP_CT_RELATED_REPLY) in ovs_ct_helper()
452 help = nfct_help(ct); in ovs_ct_helper()
483 err = helper->help(skb, protoff, ct, ctinfo); in ovs_ct_helper()
491 if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) && in ovs_ct_helper()
492 !nf_ct_seq_adjust(skb, ct, ctinfo, protoff)) in ovs_ct_helper()
572 struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h); in ovs_ct_expect_find() local
574 nf_ct_delete(ct, 0, 0); in ovs_ct_expect_find()
575 nf_conntrack_put(&ct->ct_general); in ovs_ct_expect_find()
586 const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h); in ovs_ct_get_info() local
591 if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) in ovs_ct_get_info()
593 if (test_bit(IPS_EXPECTED_BIT, &ct->status)) in ovs_ct_get_info()
613 struct nf_conn *ct; in ovs_ct_find_existing() local
637 ct = nf_ct_tuplehash_to_ctrack(h); in ovs_ct_find_existing()
644 h = &ct->tuplehash[!h->tuple.dst.dir]; in ovs_ct_find_existing()
646 nf_ct_set(skb, ct, ovs_ct_get_info(h)); in ovs_ct_find_existing()
647 return ct; in ovs_ct_find_existing()
657 struct nf_conn *ct = NULL; in ovs_ct_executed() local
670 ct = ovs_ct_find_existing(net, &info->zone, info->family, skb, in ovs_ct_executed()
675 return ct; in ovs_ct_executed()
685 struct nf_conn *ct; in skb_nfct_cached() local
688 ct = nf_ct_get(skb, &ctinfo); in skb_nfct_cached()
689 if (!ct) in skb_nfct_cached()
690 ct = ovs_ct_executed(net, key, info, skb, &ct_executed); in skb_nfct_cached()
692 if (ct) in skb_nfct_cached()
697 if (!net_eq(net, read_pnet(&ct->ct_net))) in skb_nfct_cached()
699 if (!nf_ct_zone_equal_any(info->ct, nf_ct_zone(ct))) in skb_nfct_cached()
704 help = nf_ct_ext_find(ct, NF_CT_EXT_HELPER); in skb_nfct_cached()
713 if (nf_ct_is_confirmed(ct)) in skb_nfct_cached()
714 nf_ct_delete(ct, 0, 0); in skb_nfct_cached()
716 nf_conntrack_put(&ct->ct_general); in skb_nfct_cached()
729 static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct, in ovs_ct_nat_execute() argument
751 if (!nf_nat_icmp_reply_translation(skb, ct, ctinfo, in ovs_ct_nat_execute()
764 if (!nf_nat_icmpv6_reply_translation(skb, ct, in ovs_ct_nat_execute()
778 if (!nf_nat_initialized(ct, maniptype)) { in ovs_ct_nat_execute()
784 ? nf_nat_setup_info(ct, range, maniptype) in ovs_ct_nat_execute()
785 : nf_nat_alloc_null_binding(ct, hooknum); in ovs_ct_nat_execute()
800 err = nf_nat_packet(ct, ctinfo, hooknum, skb); in ovs_ct_nat_execute()
862 struct sk_buff *skb, struct nf_conn *ct, in ovs_ct_nat() argument
869 if (!nf_ct_is_confirmed(ct) && !nf_ct_nat_ext_add(ct)) in ovs_ct_nat()
878 ct->status & IPS_NAT_MASK && in ovs_ct_nat()
886 maniptype = ct->status & IPS_SRC_NAT in ovs_ct_nat()
889 maniptype = ct->status & IPS_SRC_NAT in ovs_ct_nat()
898 err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype); in ovs_ct_nat()
909 struct sk_buff *skb, struct nf_conn *ct, in ovs_ct_nat() argument
933 struct nf_conn *ct; in __ovs_ct_lookup() local
936 struct nf_conn *tmpl = info->ct; in __ovs_ct_lookup()
962 ct = nf_ct_get(skb, &ctinfo); in __ovs_ct_lookup()
963 if (ct) { in __ovs_ct_lookup()
975 (nf_ct_is_confirmed(ct) || info->commit) && in __ovs_ct_lookup()
976 ovs_ct_nat(net, key, info, skb, ct, ctinfo) != NF_ACCEPT) { in __ovs_ct_lookup()
985 if (!nf_ct_is_confirmed(ct) && info->commit && in __ovs_ct_lookup()
986 info->helper && !nfct_help(ct)) { in __ovs_ct_lookup()
987 int err = __nf_ct_try_assign_helper(ct, info->ct, in __ovs_ct_lookup()
998 if ((nf_ct_is_confirmed(ct) ? !cached : info->commit) && in __ovs_ct_lookup()
1031 struct nf_conn *ct; in ovs_ct_lookup() local
1038 ct = (struct nf_conn *)skb_nfct(skb); in ovs_ct_lookup()
1039 if (ct) in ovs_ct_lookup()
1040 nf_ct_deliver_cached_events(ct); in ovs_ct_lookup()
1146 struct nf_conn *ct; in ovs_ct_commit() local
1154 ct = nf_ct_get(skb, &ctinfo); in ovs_ct_commit()
1155 if (!ct) in ovs_ct_commit()
1160 if (!nf_ct_is_confirmed(ct)) { in ovs_ct_commit()
1162 &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); in ovs_ct_commit()
1181 struct nf_conntrack_ecache *cache = nf_ct_ecache_find(ct); in ovs_ct_commit()
1192 err = ovs_ct_set_mark(ct, key, info->mark.value, in ovs_ct_commit()
1197 if (!nf_ct_is_confirmed(ct)) { in ovs_ct_commit()
1198 err = ovs_ct_init_labels(ct, key, &info->labels.value, in ovs_ct_commit()
1203 err = ovs_ct_set_labels(ct, key, &info->labels.value, in ovs_ct_commit()
1307 help = nf_ct_helper_ext_add(info->ct, GFP_KERNEL); in ovs_ct_add_helper()
1626 ct_info.ct = nf_ct_tmpl_alloc(net, &ct_info.zone, GFP_KERNEL); in ovs_ct_copy_action()
1627 if (!ct_info.ct) { in ovs_ct_copy_action()
1642 __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status); in ovs_ct_copy_action()
1643 nf_conntrack_get(&ct_info.ct->ct_general); in ovs_ct_copy_action()
1772 if (ct_info->ct) in __ovs_ct_free_action()
1773 nf_ct_tmpl_free(ct_info->ct); in __ovs_ct_free_action()