1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <net/act_api.h>
6 #include <uapi/linux/tc_act/tc_ct.h>
8 #if IS_ENABLED(CONFIG_NF_CONNTRACK)
9 #include <net/netfilter/nf_nat.h>
10 #include <net/netfilter/nf_conntrack_labels.h>
12 struct tcf_ct_params
{
19 u32 labels
[NF_CT_LABELS_MAX_SIZE
/ sizeof(u32
)];
20 u32 labels_mask
[NF_CT_LABELS_MAX_SIZE
/ sizeof(u32
)];
22 struct nf_nat_range2 range
;
29 struct tcf_ct_flow_table
*ct_ft
;
30 struct nf_flowtable
*nf_ft
;
34 struct tc_action common
;
35 struct tcf_ct_params __rcu
*params
;
38 #define to_ct(a) ((struct tcf_ct *)a)
39 #define to_ct_params(a) \
40 ((struct tcf_ct_params *) \
41 rcu_dereference_protected(to_ct(a)->params, \
42 lockdep_is_held(&a->tcfa_lock)))
44 static inline uint16_t tcf_ct_zone(const struct tc_action
*a
)
46 return to_ct_params(a
)->zone
;
49 static inline int tcf_ct_action(const struct tc_action
*a
)
51 return to_ct_params(a
)->ct_action
;
54 static inline struct nf_flowtable
*tcf_ct_ft(const struct tc_action
*a
)
56 return to_ct_params(a
)->nf_ft
;
60 static inline uint16_t tcf_ct_zone(const struct tc_action
*a
) { return 0; }
61 static inline int tcf_ct_action(const struct tc_action
*a
) { return 0; }
62 static inline struct nf_flowtable
*tcf_ct_ft(const struct tc_action
*a
)
66 #endif /* CONFIG_NF_CONNTRACK */
68 #if IS_ENABLED(CONFIG_NET_ACT_CT)
69 void tcf_ct_flow_table_restore_skb(struct sk_buff
*skb
, unsigned long cookie
);
72 tcf_ct_flow_table_restore_skb(struct sk_buff
*skb
, unsigned long cookie
) { }
75 static inline bool is_tcf_ct(const struct tc_action
*a
)
77 #if defined(CONFIG_NET_CLS_ACT) && IS_ENABLED(CONFIG_NF_CONNTRACK)
78 if (a
->ops
&& a
->ops
->id
== TCA_ID_CT
)
84 #endif /* __NET_TC_CT_H */