summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Stringer <joestringer@nicira.com>2015-08-28 19:22:11 -0700
committerDavid S. Miller <davem@davemloft.net>2015-08-28 22:23:59 -0700
commit0d5cdef8d5dd0a6819fd85305adb448f5ba56f24 (patch)
treee31d94a3ee3c6150df590ee973aa9280c484e9c9
parent581a5f2a6111e3d3b22f31a7d93b6bae2627e83a (diff)
downloadlinux-0d5cdef8d5dd0a6819fd85305adb448f5ba56f24.tar.bz2
openvswitch: Fix conntrack compilation without mark.
Fix build with !CONFIG_NF_CONNTRACK_MARK && CONFIG_OPENVSWITCH_CONNTRACK Fixes: 182e304 ("openvswitch: Allow matching on conntrack mark") Reported-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Joe Stringer <joestringer@nicira.com> Tested-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/openvswitch/conntrack.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index 886bd2758502..e8e524ad8a01 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -100,6 +100,15 @@ static u8 ovs_ct_get_state(enum ip_conntrack_info ctinfo)
return ct_state;
}
+static u32 ovs_ct_get_mark(const struct nf_conn *ct)
+{
+#if IS_ENABLED(CONFIG_NF_CONNTRACK_MARK)
+ return ct ? ct->mark : 0;
+#else
+ return 0;
+#endif
+}
+
static void ovs_ct_get_label(const struct nf_conn *ct,
struct ovs_key_ct_label *label)
{
@@ -124,7 +133,7 @@ static void __ovs_ct_update_key(struct sw_flow_key *key, u8 state,
{
key->ct.state = state;
key->ct.zone = zone->id;
- key->ct.mark = ct ? ct->mark : 0;
+ key->ct.mark = ovs_ct_get_mark(ct);
ovs_ct_get_label(ct, &key->ct.label);
}
@@ -180,12 +189,11 @@ int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb)
static int ovs_ct_set_mark(struct sk_buff *skb, struct sw_flow_key *key,
u32 ct_mark, u32 mask)
{
+#if IS_ENABLED(CONFIG_NF_CONNTRACK_MARK)
enum ip_conntrack_info ctinfo;
struct nf_conn *ct;
u32 new_mark;
- if (!IS_ENABLED(CONFIG_NF_CONNTRACK_MARK))
- return -ENOTSUPP;
/* The connection could be invalid, in which case set_mark is no-op. */
ct = nf_ct_get(skb, &ctinfo);
@@ -200,6 +208,9 @@ static int ovs_ct_set_mark(struct sk_buff *skb, struct sw_flow_key *key,
}
return 0;
+#else
+ return -ENOTSUPP;
+#endif
}
static int ovs_ct_set_label(struct sk_buff *skb, struct sw_flow_key *key,