]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - net/openvswitch/conntrack.h
87b289c58978739e005dc94095d5e656454115ba
[karo-tx-linux.git] / net / openvswitch / conntrack.h
1 /*
2  * Copyright (c) 2015 Nicira, Inc.
3  *
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.
7  *
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.
12  */
13
14 #ifndef OVS_CONNTRACK_H
15 #define OVS_CONNTRACK_H 1
16
17 #include "flow.h"
18
19 struct ovs_conntrack_info;
20 enum ovs_key_attr;
21
22 #if defined(CONFIG_OPENVSWITCH_CONNTRACK)
23 bool ovs_ct_verify(enum ovs_key_attr attr);
24 int ovs_ct_copy_action(struct net *, const struct nlattr *,
25                        const struct sw_flow_key *, struct sw_flow_actions **,
26                        bool log);
27 int ovs_ct_action_to_attr(const struct ovs_conntrack_info *, struct sk_buff *);
28
29 int ovs_ct_execute(struct net *, struct sk_buff *, struct sw_flow_key *,
30                    const struct ovs_conntrack_info *);
31
32 void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key);
33 int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb);
34 void ovs_ct_free_action(const struct nlattr *a);
35 #else
36 #include <linux/errno.h>
37
38 static inline bool ovs_ct_verify(int attr)
39 {
40         return false;
41 }
42
43 static inline int ovs_ct_copy_action(struct net *net, const struct nlattr *nla,
44                                      const struct sw_flow_key *key,
45                                      struct sw_flow_actions **acts, bool log)
46 {
47         return -ENOTSUPP;
48 }
49
50 static inline int ovs_ct_action_to_attr(const struct ovs_conntrack_info *info,
51                                         struct sk_buff *skb)
52 {
53         return -ENOTSUPP;
54 }
55
56 static inline int ovs_ct_execute(struct net *net, struct sk_buff *skb,
57                                  struct sw_flow_key *key,
58                                  const struct ovs_conntrack_info *info)
59 {
60         return -ENOTSUPP;
61 }
62
63 static inline void ovs_ct_fill_key(const struct sk_buff *skb,
64                                    struct sw_flow_key *key)
65 {
66         key->ct.state = 0;
67         key->ct.zone = 0;
68         key->ct.mark = 0;
69 }
70
71 static inline int ovs_ct_put_key(const struct sw_flow_key *key,
72                                  struct sk_buff *skb)
73 {
74         return 0;
75 }
76
77 static inline void ovs_ct_free_action(const struct nlattr *a) { }
78 #endif
79 #endif /* ovs_conntrack.h */