summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAles Musil <amusil@redhat.com>2023-01-16 12:45:07 +0100
committerIlya Maximets <i.maximets@ovn.org>2023-01-16 19:55:21 +0100
commita9ae73b916bad528dcac2b8bb302fee6935fc163 (patch)
tree25a2386f4dbc3a9467a092e8c93ddcd1e762e9e1 /include
parentde3bbdc479a9a78135e1922e4e6011732515e7ef (diff)
downloadopenvswitch-a9ae73b916bad528dcac2b8bb302fee6935fc163.tar.gz
ofp, dpif: Allow CT flush based on partial match.
Currently, the CT can be flushed by dpctl only by specifying the whole 5-tuple. This is not very convenient when there are only some fields known to the user of CT flush. Add new struct ofp_ct_match which represents the generic filtering that can be done for CT flush. The match is done only on fields that are non-zero with exception to the icmp fields. This allows the filtering just within dpctl, however it is a preparation for OpenFlow extension. Reported-at: https://bugzilla.redhat.com/2120546 Signed-off-by: Ales Musil <amusil@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'include')
-rw-r--r--include/openvswitch/automake.mk1
-rw-r--r--include/openvswitch/ofp-ct.h66
2 files changed, 67 insertions, 0 deletions
diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk
index 84670d80a..0cc1f569e 100644
--- a/include/openvswitch/automake.mk
+++ b/include/openvswitch/automake.mk
@@ -15,6 +15,7 @@ openvswitchinclude_HEADERS = \
include/openvswitch/ofp-actions.h \
include/openvswitch/ofp-bundle.h \
include/openvswitch/ofp-connection.h \
+ include/openvswitch/ofp-ct.h \
include/openvswitch/ofp-ed-props.h \
include/openvswitch/ofp-errors.h \
include/openvswitch/ofp-flow.h \
diff --git a/include/openvswitch/ofp-ct.h b/include/openvswitch/ofp-ct.h
new file mode 100644
index 000000000..3d919ddf9
--- /dev/null
+++ b/include/openvswitch/ofp-ct.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2023, Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OPENVSWITCH_OFP_CT_H
+#define OPENVSWITCH_OFP_CT_H 1
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ofp_ct_tuple {
+ struct in6_addr src;
+ struct in6_addr dst;
+
+ union {
+ ovs_be16 src_port;
+ ovs_be16 icmp_id;
+ };
+ union {
+ ovs_be16 dst_port;
+ struct {
+ uint8_t icmp_code;
+ uint8_t icmp_type;
+ };
+ };
+};
+
+struct ofp_ct_match {
+ uint8_t ip_proto;
+ uint16_t l3_type;
+
+ struct ofp_ct_tuple tuple_orig;
+ struct ofp_ct_tuple tuple_reply;
+};
+
+bool ofp_ct_match_is_zero(const struct ofp_ct_match *);
+bool ofp_ct_tuple_is_zero(const struct ofp_ct_tuple *, uint8_t ip_proto);
+bool ofp_ct_tuple_is_five_tuple(const struct ofp_ct_tuple *, uint8_t ip_proto);
+
+void ofp_ct_match_format(struct ds *, const struct ofp_ct_match *);
+bool ofp_ct_tuple_parse(struct ofp_ct_tuple *, const char *,
+ struct ds *, uint8_t *ip_proto, uint16_t *l3_type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ofp-ct.h */