blob: e812ee64a718c5591149b934d52ea822787e2610 [file] [log] [blame]
Joe Stringer7f8a4362015-08-26 11:31:48 -07001/*
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
19struct ovs_conntrack_info;
20enum ovs_key_attr;
21
22#if defined(CONFIG_OPENVSWITCH_CONNTRACK)
23bool ovs_ct_verify(enum ovs_key_attr attr);
24int ovs_ct_copy_action(struct net *, const struct nlattr *,
25 const struct sw_flow_key *, struct sw_flow_actions **,
26 bool log);
27int ovs_ct_action_to_attr(const struct ovs_conntrack_info *, struct sk_buff *);
28
29int ovs_ct_execute(struct net *, struct sk_buff *, struct sw_flow_key *,
30 const struct ovs_conntrack_info *);
31
32void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key);
33int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb);
34void ovs_ct_free_action(const struct nlattr *a);
35#else
36#include <linux/errno.h>
37
38static inline bool ovs_ct_verify(int attr)
39{
40 return false;
41}
42
43static 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
50static inline int ovs_ct_action_to_attr(const struct ovs_conntrack_info *info,
51 struct sk_buff *skb)
52{
53 return -ENOTSUPP;
54}
55
56static 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
63static 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}
69
70static inline int ovs_ct_put_key(const struct sw_flow_key *key,
71 struct sk_buff *skb)
72{
73 return 0;
74}
75
76static inline void ovs_ct_free_action(const struct nlattr *a) { }
77#endif
78#endif /* ovs_conntrack.h */