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 #include <linux/kconfig.h>
15 #include <linux/version.h>
17 #if IS_ENABLED(CONFIG_NF_CONNTRACK)
19 #include <linux/module.h>
20 #include <linux/openvswitch.h>
22 #include <net/netfilter/nf_conntrack_core.h>
23 #include <net/netfilter/nf_conntrack_helper.h>
24 #include <net/netfilter/nf_conntrack_labels.h>
25 #include <net/netfilter/nf_conntrack_zones.h>
26 #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
29 #include "conntrack.h"
31 #include "flow_netlink.h"
34 struct ovs_ct_len_tbl {
39 /* Metadata mark for masked write to conntrack mark */
45 /* Metadata label for masked write to conntrack label. */
47 struct ovs_key_ct_labels value;
48 struct ovs_key_ct_labels mask;
51 /* Conntrack action context for execution. */
52 struct ovs_conntrack_info {
53 struct nf_conntrack_helper *helper;
54 struct nf_conntrack_zone zone;
59 struct md_labels labels;
62 static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info);
64 static u16 key_to_nfproto(const struct sw_flow_key *key)
66 switch (ntohs(key->eth.type)) {
72 return NFPROTO_UNSPEC;
76 /* Map SKB connection state into the values used by flow definition. */
77 static u8 ovs_ct_get_state(enum ip_conntrack_info ctinfo)
79 u8 ct_state = OVS_CS_F_TRACKED;
82 case IP_CT_ESTABLISHED_REPLY:
83 case IP_CT_RELATED_REPLY:
84 ct_state |= OVS_CS_F_REPLY_DIR;
91 case IP_CT_ESTABLISHED:
92 case IP_CT_ESTABLISHED_REPLY:
93 ct_state |= OVS_CS_F_ESTABLISHED;
96 case IP_CT_RELATED_REPLY:
97 ct_state |= OVS_CS_F_RELATED;
100 ct_state |= OVS_CS_F_NEW;
109 static u32 ovs_ct_get_mark(const struct nf_conn *ct)
111 #if IS_ENABLED(CONFIG_NF_CONNTRACK_MARK)
112 return ct ? ct->mark : 0;
118 static void ovs_ct_get_labels(const struct nf_conn *ct,
119 struct ovs_key_ct_labels *labels)
121 struct nf_conn_labels *cl = ct ? nf_ct_labels_find(ct) : NULL;
124 size_t len = cl->words * sizeof(long);
126 if (len > OVS_CT_LABELS_LEN)
127 len = OVS_CT_LABELS_LEN;
128 else if (len < OVS_CT_LABELS_LEN)
129 memset(labels, 0, OVS_CT_LABELS_LEN);
130 memcpy(labels, cl->bits, len);
132 memset(labels, 0, OVS_CT_LABELS_LEN);
136 static void __ovs_ct_update_key(struct sw_flow_key *key, u8 state,
137 const struct nf_conntrack_zone *zone,
138 const struct nf_conn *ct)
140 key->ct.state = state;
141 key->ct.zone = zone->id;
142 key->ct.mark = ovs_ct_get_mark(ct);
143 ovs_ct_get_labels(ct, &key->ct.labels);
146 /* Update 'key' based on skb->nfct. If 'post_ct' is true, then OVS has
147 * previously sent the packet to conntrack via the ct action.
149 static void ovs_ct_update_key(const struct sk_buff *skb,
150 const struct ovs_conntrack_info *info,
151 struct sw_flow_key *key, bool post_ct)
153 const struct nf_conntrack_zone *zone = &nf_ct_zone_dflt;
154 enum ip_conntrack_info ctinfo;
158 ct = nf_ct_get(skb, &ctinfo);
160 state = ovs_ct_get_state(ctinfo);
161 /* All unconfirmed entries are NEW connections. */
162 if (!nf_ct_is_confirmed(ct))
163 state |= OVS_CS_F_NEW;
164 /* OVS persists the related flag for the duration of the
168 state |= OVS_CS_F_RELATED;
169 zone = nf_ct_zone(ct);
170 } else if (post_ct) {
171 state = OVS_CS_F_TRACKED | OVS_CS_F_INVALID;
175 __ovs_ct_update_key(key, state, zone, ct);
178 /* This is called to initialize CT key fields possibly coming in from the local
181 void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key)
183 ovs_ct_update_key(skb, NULL, key, false);
186 int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb)
188 if (nla_put_u32(skb, OVS_KEY_ATTR_CT_STATE, key->ct.state))
191 if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) &&
192 nla_put_u16(skb, OVS_KEY_ATTR_CT_ZONE, key->ct.zone))
195 if (IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) &&
196 nla_put_u32(skb, OVS_KEY_ATTR_CT_MARK, key->ct.mark))
199 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) &&
200 nla_put(skb, OVS_KEY_ATTR_CT_LABELS, sizeof(key->ct.labels),
207 static int ovs_ct_set_mark(struct sk_buff *skb, struct sw_flow_key *key,
208 u32 ct_mark, u32 mask)
210 #if IS_ENABLED(CONFIG_NF_CONNTRACK_MARK)
211 enum ip_conntrack_info ctinfo;
215 /* The connection could be invalid, in which case set_mark is no-op. */
216 ct = nf_ct_get(skb, &ctinfo);
220 new_mark = ct_mark | (ct->mark & ~(mask));
221 if (ct->mark != new_mark) {
223 nf_conntrack_event_cache(IPCT_MARK, ct);
224 key->ct.mark = new_mark;
233 static int ovs_ct_set_labels(struct sk_buff *skb, struct sw_flow_key *key,
234 const struct ovs_key_ct_labels *labels,
235 const struct ovs_key_ct_labels *mask)
237 enum ip_conntrack_info ctinfo;
238 struct nf_conn_labels *cl;
242 /* The connection could be invalid, in which case set_label is no-op.*/
243 ct = nf_ct_get(skb, &ctinfo);
247 cl = nf_ct_labels_find(ct);
249 nf_ct_labels_ext_add(ct);
250 cl = nf_ct_labels_find(ct);
252 if (!cl || cl->words * sizeof(long) < OVS_CT_LABELS_LEN)
255 err = nf_connlabels_replace(ct, (u32 *)labels, (u32 *)mask,
256 OVS_CT_LABELS_LEN / sizeof(u32));
260 ovs_ct_get_labels(ct, &key->ct.labels);
264 /* 'skb' should already be pulled to nh_ofs. */
265 static int ovs_ct_helper(struct sk_buff *skb, u16 proto)
267 const struct nf_conntrack_helper *helper;
268 const struct nf_conn_help *help;
269 enum ip_conntrack_info ctinfo;
270 unsigned int protoff;
273 ct = nf_ct_get(skb, &ctinfo);
274 if (!ct || ctinfo == IP_CT_RELATED_REPLY)
277 help = nfct_help(ct);
281 helper = rcu_dereference(help->helper);
287 protoff = ip_hdrlen(skb);
290 u8 nexthdr = ipv6_hdr(skb)->nexthdr;
294 ofs = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr,
296 if (ofs < 0 || (frag_off & htons(~0x7)) != 0) {
297 pr_debug("proto header not found\n");
304 WARN_ONCE(1, "helper invoked on non-IP family!");
308 return helper->help(skb, protoff, ct, ctinfo);
311 /* Returns 0 on success, -EINPROGRESS if 'skb' is stolen, or other nonzero
312 * value if 'skb' is freed.
314 static int handle_fragments(struct net *net, struct sw_flow_key *key,
315 u16 zone, struct sk_buff *skb)
317 struct ovs_gso_cb ovs_cb = *OVS_GSO_CB(skb);
321 OVS_NLERR(true, "%s: skb has no dev; dropping", __func__);
325 if (key->eth.type == htons(ETH_P_IP)) {
326 enum ip_defrag_users user = IP_DEFRAG_CONNTRACK_IN + zone;
328 memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
329 err = ip_defrag(net, skb, user);
333 ovs_cb.dp_cb.mru = IPCB(skb)->frag_max_size;
334 #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
335 } else if (key->eth.type == htons(ETH_P_IPV6)) {
336 enum ip6_defrag_users user = IP6_DEFRAG_CONNTRACK_IN + zone;
339 memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm));
340 err = nf_ct_frag6_gather(net, skb, user);
344 key->ip.proto = ipv6_hdr(skb)->nexthdr;
345 ovs_cb.dp_cb.mru = IP6CB(skb)->frag_max_size;
346 #endif /* IP frag support */
349 return -EPFNOSUPPORT;
352 key->ip.frag = OVS_FRAG_TYPE_NONE;
355 *OVS_GSO_CB(skb) = ovs_cb;
360 static struct nf_conntrack_expect *
361 ovs_ct_expect_find(struct net *net, const struct nf_conntrack_zone *zone,
362 u16 proto, const struct sk_buff *skb)
364 struct nf_conntrack_tuple tuple;
366 if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb), proto, net, &tuple))
368 return __nf_ct_expect_find(net, zone, &tuple);
371 /* This replicates logic from nf_conntrack_core.c that is not exported. */
372 static enum ip_conntrack_info
373 ovs_ct_get_info(const struct nf_conntrack_tuple_hash *h)
375 const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h);
377 if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY)
378 return IP_CT_ESTABLISHED_REPLY;
379 /* Once we've had two way comms, always ESTABLISHED. */
380 if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status))
381 return IP_CT_ESTABLISHED;
382 if (test_bit(IPS_EXPECTED_BIT, &ct->status))
383 return IP_CT_RELATED;
387 /* Find an existing connection which this packet belongs to without
388 * re-attributing statistics or modifying the connection state. This allows an
389 * skb->nfct lost due to an upcall to be recovered during actions execution.
391 * Must be called with rcu_read_lock.
393 * On success, populates skb->nfct and skb->nfctinfo, and returns the
394 * connection. Returns NULL if there is no existing entry.
396 static struct nf_conn *
397 ovs_ct_find_existing(struct net *net, const struct nf_conntrack_zone *zone,
398 u8 l3num, struct sk_buff *skb)
400 struct nf_conntrack_l3proto *l3proto;
401 struct nf_conntrack_l4proto *l4proto;
402 struct nf_conntrack_tuple tuple;
403 struct nf_conntrack_tuple_hash *h;
404 enum ip_conntrack_info ctinfo;
406 unsigned int dataoff;
409 l3proto = __nf_ct_l3proto_find(l3num);
411 pr_debug("ovs_ct_find_existing: Can't get l3proto\n");
414 if (l3proto->get_l4proto(skb, skb_network_offset(skb), &dataoff,
416 pr_debug("ovs_ct_find_existing: Can't get protonum\n");
419 l4proto = __nf_ct_l4proto_find(l3num, protonum);
421 pr_debug("ovs_ct_find_existing: Can't get l4proto\n");
424 if (!nf_ct_get_tuple(skb, skb_network_offset(skb), dataoff, l3num,
425 protonum, net, &tuple, l3proto, l4proto)) {
426 pr_debug("ovs_ct_find_existing: Can't get tuple\n");
430 /* look for tuple match */
431 h = nf_conntrack_find_get(net, zone, &tuple);
433 return NULL; /* Not found. */
435 ct = nf_ct_tuplehash_to_ctrack(h);
437 ctinfo = ovs_ct_get_info(h);
438 if (ctinfo == IP_CT_NEW) {
439 /* This should not happen. */
440 WARN_ONCE(1, "ovs_ct_find_existing: new packet for %p\n", ct);
442 skb->nfct = &ct->ct_general;
443 skb->nfctinfo = ctinfo;
447 /* Determine whether skb->nfct is equal to the result of conntrack lookup. */
448 static bool skb_nfct_cached(struct net *net,
449 const struct sw_flow_key *key,
450 const struct ovs_conntrack_info *info,
453 enum ip_conntrack_info ctinfo;
456 ct = nf_ct_get(skb, &ctinfo);
457 /* If no ct, check if we have evidence that an existing conntrack entry
458 * might be found for this skb. This happens when we lose a skb->nfct
459 * due to an upcall. If the connection was not confirmed, it is not
460 * cached and needs to be run through conntrack again.
462 if (!ct && key->ct.state & OVS_CS_F_TRACKED &&
463 !(key->ct.state & OVS_CS_F_INVALID) &&
464 key->ct.zone == info->zone.id)
465 ct = ovs_ct_find_existing(net, &info->zone, info->family, skb);
468 if (!net_eq(net, read_pnet(&ct->ct_net)))
470 if (!nf_ct_zone_equal_any(info->ct, nf_ct_zone(ct)))
473 struct nf_conn_help *help;
475 help = nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
476 if (help && rcu_access_pointer(help->helper) != info->helper)
483 /* Pass 'skb' through conntrack in 'net', using zone configured in 'info', if
484 * not done already. Update key with new CT state after passing the packet
486 * Note that if the packet is deemed invalid by conntrack, skb->nfct will be
487 * set to NULL and 0 will be returned.
489 static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
490 const struct ovs_conntrack_info *info,
493 /* If we are recirculating packets to match on conntrack fields and
494 * committing with a separate conntrack action, then we don't need to
495 * actually run the packet through conntrack twice unless it's for a
498 if (!skb_nfct_cached(net, key, info, skb)) {
499 struct nf_conn *tmpl = info->ct;
501 /* Associate skb with specified zone. */
504 nf_conntrack_put(skb->nfct);
505 nf_conntrack_get(&tmpl->ct_general);
506 skb->nfct = &tmpl->ct_general;
507 skb->nfctinfo = IP_CT_NEW;
510 if (nf_conntrack_in(net, info->family, NF_INET_FORWARD,
514 ovs_ct_update_key(skb, info, key, true);
516 if (ovs_ct_helper(skb, info->family) != NF_ACCEPT) {
517 WARN_ONCE(1, "helper rejected packet");
525 /* Lookup connection and read fields into key. */
526 static int ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
527 const struct ovs_conntrack_info *info,
530 struct nf_conntrack_expect *exp;
532 /* If we pass an expected packet through nf_conntrack_in() the
533 * expectation is typically removed, but the packet could still be
534 * lost in upcall processing. To prevent this from happening we
535 * perform an explicit expectation lookup. Expected connections are
536 * always new, and will be passed through conntrack only when they are
537 * committed, as it is OK to remove the expectation at that time.
539 exp = ovs_ct_expect_find(net, &info->zone, info->family, skb);
543 state = OVS_CS_F_TRACKED | OVS_CS_F_NEW | OVS_CS_F_RELATED;
544 __ovs_ct_update_key(key, state, &info->zone, exp->master);
548 err = __ovs_ct_lookup(net, key, info, skb);
556 /* Lookup connection and confirm if unconfirmed. */
557 static int ovs_ct_commit(struct net *net, struct sw_flow_key *key,
558 const struct ovs_conntrack_info *info,
563 err = __ovs_ct_lookup(net, key, info, skb);
566 /* This is a no-op if the connection has already been confirmed. */
567 if (nf_conntrack_confirm(skb) != NF_ACCEPT)
573 static bool labels_nonzero(const struct ovs_key_ct_labels *labels)
577 for (i = 0; i < sizeof(*labels); i++)
578 if (labels->ct_labels[i])
584 /* Returns 0 on success, -EINPROGRESS if 'skb' is stolen, or other nonzero
585 * value if 'skb' is freed.
587 int ovs_ct_execute(struct net *net, struct sk_buff *skb,
588 struct sw_flow_key *key,
589 const struct ovs_conntrack_info *info)
594 /* The conntrack module expects to be working at L3. */
595 nh_ofs = skb_network_offset(skb);
596 skb_pull(skb, nh_ofs);
598 if (key->ip.frag != OVS_FRAG_TYPE_NONE) {
599 err = handle_fragments(net, key, info->zone.id, skb);
605 err = ovs_ct_commit(net, key, info, skb);
607 err = ovs_ct_lookup(net, key, info, skb);
611 if (info->mark.mask) {
612 err = ovs_ct_set_mark(skb, key, info->mark.value,
617 if (labels_nonzero(&info->labels.mask))
618 err = ovs_ct_set_labels(skb, key, &info->labels.value,
621 skb_push(skb, nh_ofs);
627 static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name,
628 const struct sw_flow_key *key, bool log)
630 struct nf_conntrack_helper *helper;
631 struct nf_conn_help *help;
633 helper = nf_conntrack_helper_try_module_get(name, info->family,
636 OVS_NLERR(log, "Unknown helper \"%s\"", name);
640 help = nf_ct_helper_ext_add(info->ct, helper, GFP_KERNEL);
642 module_put(helper->me);
646 rcu_assign_pointer(help->helper, helper);
647 info->helper = helper;
651 static const struct ovs_ct_len_tbl ovs_ct_attr_lens[OVS_CT_ATTR_MAX + 1] = {
652 [OVS_CT_ATTR_COMMIT] = { .minlen = 0, .maxlen = 0 },
653 [OVS_CT_ATTR_ZONE] = { .minlen = sizeof(u16),
654 .maxlen = sizeof(u16) },
655 [OVS_CT_ATTR_MARK] = { .minlen = sizeof(struct md_mark),
656 .maxlen = sizeof(struct md_mark) },
657 [OVS_CT_ATTR_LABELS] = { .minlen = sizeof(struct md_labels),
658 .maxlen = sizeof(struct md_labels) },
659 [OVS_CT_ATTR_HELPER] = { .minlen = 1,
660 .maxlen = NF_CT_HELPER_NAME_LEN }
663 static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
664 const char **helper, bool log)
669 nla_for_each_nested(a, attr, rem) {
670 int type = nla_type(a);
671 int maxlen = ovs_ct_attr_lens[type].maxlen;
672 int minlen = ovs_ct_attr_lens[type].minlen;
674 if (type > OVS_CT_ATTR_MAX) {
676 "Unknown conntrack attr (type=%d, max=%d)",
677 type, OVS_CT_ATTR_MAX);
680 if (nla_len(a) < minlen || nla_len(a) > maxlen) {
682 "Conntrack attr type has unexpected length (type=%d, length=%d, expected=%d)",
683 type, nla_len(a), maxlen);
688 case OVS_CT_ATTR_COMMIT:
691 #ifdef CONFIG_NF_CONNTRACK_ZONES
692 case OVS_CT_ATTR_ZONE:
693 info->zone.id = nla_get_u16(a);
696 #ifdef CONFIG_NF_CONNTRACK_MARK
697 case OVS_CT_ATTR_MARK: {
698 struct md_mark *mark = nla_data(a);
701 OVS_NLERR(log, "ct_mark mask cannot be 0");
708 #ifdef CONFIG_NF_CONNTRACK_LABELS
709 case OVS_CT_ATTR_LABELS: {
710 struct md_labels *labels = nla_data(a);
712 if (!labels_nonzero(&labels->mask)) {
713 OVS_NLERR(log, "ct_labels mask cannot be 0");
716 info->labels = *labels;
720 case OVS_CT_ATTR_HELPER:
721 *helper = nla_data(a);
722 if (!memchr(*helper, '\0', nla_len(a))) {
723 OVS_NLERR(log, "Invalid conntrack helper");
728 OVS_NLERR(log, "Unknown conntrack attr (%d)",
735 OVS_NLERR(log, "Conntrack attr has %d unknown bytes", rem);
742 bool ovs_ct_verify(struct net *net, enum ovs_key_attr attr)
744 if (attr == OVS_KEY_ATTR_CT_STATE)
746 if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) &&
747 attr == OVS_KEY_ATTR_CT_ZONE)
749 if (IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) &&
750 attr == OVS_KEY_ATTR_CT_MARK)
752 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) &&
753 attr == OVS_KEY_ATTR_CT_LABELS) {
754 struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
756 return ovs_net->xt_label;
762 int ovs_ct_copy_action(struct net *net, const struct nlattr *attr,
763 const struct sw_flow_key *key,
764 struct sw_flow_actions **sfa, bool log)
766 struct ovs_conntrack_info ct_info;
767 const char *helper = NULL;
771 family = key_to_nfproto(key);
772 if (family == NFPROTO_UNSPEC) {
773 OVS_NLERR(log, "ct family unspecified");
777 memset(&ct_info, 0, sizeof(ct_info));
778 ct_info.family = family;
780 nf_ct_zone_init(&ct_info.zone, NF_CT_DEFAULT_ZONE_ID,
781 NF_CT_DEFAULT_ZONE_DIR, 0);
783 err = parse_ct(attr, &ct_info, &helper, log);
787 /* Set up template for tracking connections in specific zones. */
788 ct_info.ct = nf_ct_tmpl_alloc(net, &ct_info.zone, GFP_KERNEL);
790 OVS_NLERR(log, "Failed to allocate conntrack template");
794 __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status);
795 nf_conntrack_get(&ct_info.ct->ct_general);
798 err = ovs_ct_add_helper(&ct_info, helper, key, log);
803 err = ovs_nla_add_action(sfa, OVS_ACTION_ATTR_CT, &ct_info,
804 sizeof(ct_info), log);
810 __ovs_ct_free_action(&ct_info);
814 int ovs_ct_action_to_attr(const struct ovs_conntrack_info *ct_info,
817 struct nlattr *start;
819 start = nla_nest_start(skb, OVS_ACTION_ATTR_CT);
823 if (ct_info->commit && nla_put_flag(skb, OVS_CT_ATTR_COMMIT))
825 if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) &&
826 nla_put_u16(skb, OVS_CT_ATTR_ZONE, ct_info->zone.id))
828 if (IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) && ct_info->mark.mask &&
829 nla_put(skb, OVS_CT_ATTR_MARK, sizeof(ct_info->mark),
832 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) &&
833 labels_nonzero(&ct_info->labels.mask) &&
834 nla_put(skb, OVS_CT_ATTR_LABELS, sizeof(ct_info->labels),
837 if (ct_info->helper) {
838 if (nla_put_string(skb, OVS_CT_ATTR_HELPER,
839 ct_info->helper->name))
843 nla_nest_end(skb, start);
848 void ovs_ct_free_action(const struct nlattr *a)
850 struct ovs_conntrack_info *ct_info = nla_data(a);
852 __ovs_ct_free_action(ct_info);
855 static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info)
858 module_put(ct_info->helper->me);
860 nf_ct_tmpl_free(ct_info->ct);
863 void ovs_ct_init(struct net *net)
865 unsigned int n_bits = sizeof(struct ovs_key_ct_labels) * BITS_PER_BYTE;
866 struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
868 if (nf_connlabels_get(net, n_bits)) {
869 ovs_net->xt_label = false;
870 OVS_NLERR(true, "Failed to set connlabel length");
872 ovs_net->xt_label = true;
876 void ovs_ct_exit(struct net *net)
878 struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
880 if (ovs_net->xt_label)
881 nf_connlabels_put(net);
884 #endif /* CONFIG_NF_CONNTRACK */