Skip to content

Commit a507c34

Browse files
committed
Merge branch 'openvswitch-Conntrack-integration-improvements'
2 parents 9878f60 + 316d4d7 commit a507c34

File tree

8 files changed

+420
-113
lines changed

8 files changed

+420
-113
lines changed

include/uapi/linux/openvswitch.h

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/*
3-
* Copyright (c) 2007-2013 Nicira, Inc.
3+
* Copyright (c) 2007-2017 Nicira, Inc.
44
*
55
* This program is free software; you can redistribute it and/or
66
* modify it under the terms of version 2 of the GNU General Public
@@ -331,6 +331,8 @@ enum ovs_key_attr {
331331
OVS_KEY_ATTR_CT_ZONE, /* u16 connection tracking zone. */
332332
OVS_KEY_ATTR_CT_MARK, /* u32 connection tracking mark */
333333
OVS_KEY_ATTR_CT_LABELS, /* 16-octet connection tracking label */
334+
OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4, /* struct ovs_key_ct_tuple_ipv4 */
335+
OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6, /* struct ovs_key_ct_tuple_ipv6 */
334336

335337
#ifdef __KERNEL__
336338
OVS_KEY_ATTR_TUNNEL_INFO, /* struct ip_tunnel_info */
@@ -446,9 +448,13 @@ struct ovs_key_nd {
446448
__u8 nd_tll[ETH_ALEN];
447449
};
448450

449-
#define OVS_CT_LABELS_LEN 16
451+
#define OVS_CT_LABELS_LEN_32 4
452+
#define OVS_CT_LABELS_LEN (OVS_CT_LABELS_LEN_32 * sizeof(__u32))
450453
struct ovs_key_ct_labels {
451-
__u8 ct_labels[OVS_CT_LABELS_LEN];
454+
union {
455+
__u8 ct_labels[OVS_CT_LABELS_LEN];
456+
__u32 ct_labels_32[OVS_CT_LABELS_LEN_32];
457+
};
452458
};
453459

454460
/* OVS_KEY_ATTR_CT_STATE flags */
@@ -468,6 +474,22 @@ struct ovs_key_ct_labels {
468474

469475
#define OVS_CS_F_NAT_MASK (OVS_CS_F_SRC_NAT | OVS_CS_F_DST_NAT)
470476

477+
struct ovs_key_ct_tuple_ipv4 {
478+
__be32 ipv4_src;
479+
__be32 ipv4_dst;
480+
__be16 src_port;
481+
__be16 dst_port;
482+
__u8 ipv4_proto;
483+
};
484+
485+
struct ovs_key_ct_tuple_ipv6 {
486+
__be32 ipv6_src[4];
487+
__be32 ipv6_dst[4];
488+
__be16 src_port;
489+
__be16 dst_port;
490+
__u8 ipv6_proto;
491+
};
492+
471493
/**
472494
* enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
473495
* @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
@@ -652,6 +674,10 @@ struct ovs_action_hash {
652674
* @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG.
653675
* @OVS_CT_ATTR_NAT: Nested OVS_NAT_ATTR_* for performing L3 network address
654676
* translation (NAT) on the packet.
677+
* @OVS_CT_ATTR_FORCE_COMMIT: Like %OVS_CT_ATTR_COMMIT, but instead of doing
678+
* nothing if the connection is already committed will check that the current
679+
* packet is in conntrack entry's original direction. If directionality does
680+
* not match, will delete the existing conntrack entry and commit a new one.
655681
*/
656682
enum ovs_ct_attr {
657683
OVS_CT_ATTR_UNSPEC,
@@ -662,6 +688,7 @@ enum ovs_ct_attr {
662688
OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of
663689
related connections. */
664690
OVS_CT_ATTR_NAT, /* Nested OVS_NAT_ATTR_* */
691+
OVS_CT_ATTR_FORCE_COMMIT, /* No argument */
665692
__OVS_CT_ATTR_MAX
666693
};
667694

net/openvswitch/actions.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,8 @@ static int execute_masked_set_action(struct sk_buff *skb,
10741074
case OVS_KEY_ATTR_CT_ZONE:
10751075
case OVS_KEY_ATTR_CT_MARK:
10761076
case OVS_KEY_ATTR_CT_LABELS:
1077+
case OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4:
1078+
case OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6:
10771079
err = -EINVAL;
10781080
break;
10791081
}

0 commit comments

Comments
 (0)