2 * Copyright (c) 2015 Nicira, Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
14 #ifndef OVS_CONNTRACK_H
15 #define OVS_CONNTRACK_H 1
17 #include <linux/version.h>
20 struct ovs_conntrack_info;
23 #if IS_ENABLED(CONFIG_NF_CONNTRACK) && LINUX_VERSION_CODE > KERNEL_VERSION(3,9,0)
24 bool ovs_ct_verify(enum ovs_key_attr attr);
25 int ovs_ct_copy_action(struct net *, const struct nlattr *,
26 const struct sw_flow_key *, struct sw_flow_actions **,
28 int ovs_ct_action_to_attr(const struct ovs_conntrack_info *, struct sk_buff *);
30 int ovs_ct_execute(struct net *, struct sk_buff *, struct sw_flow_key *,
31 const struct ovs_conntrack_info *);
33 void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key);
34 int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb);
35 void ovs_ct_free_action(const struct nlattr *a);
37 #include <linux/errno.h>
39 static inline bool ovs_ct_verify(int attr)
44 static inline int ovs_ct_copy_action(struct net *net, const struct nlattr *nla,
45 const struct sw_flow_key *key,
46 struct sw_flow_actions **acts, bool log)
51 static inline int ovs_ct_action_to_attr(const struct ovs_conntrack_info *info,
57 static inline int ovs_ct_execute(struct net *net, struct sk_buff *skb,
58 struct sw_flow_key *key,
59 const struct ovs_conntrack_info *info)
64 static inline void ovs_ct_fill_key(const struct sk_buff *skb,
65 struct sw_flow_key *key)
72 static inline int ovs_ct_put_key(const struct sw_flow_key *key,
78 static inline void ovs_ct_free_action(const struct nlattr *a) { }
80 #endif /* ovs_conntrack.h */