summaryrefslogtreecommitdiff
path: root/ofproto/ofproto.c
diff options
context:
space:
mode:
authorAles Musil <amusil@redhat.com>2023-01-16 12:45:08 +0100
committerIlya Maximets <i.maximets@ovn.org>2023-01-16 19:58:08 +0100
commit08146bf7d9b4ad635312901ae017370b0108c62f (patch)
treecf7f599ca0a549128e553d95b28fed0dd59c77af /ofproto/ofproto.c
parenta9ae73b916bad528dcac2b8bb302fee6935fc163 (diff)
downloadopenvswitch-08146bf7d9b4ad635312901ae017370b0108c62f.tar.gz
openflow: Add extension to flush CT by generic match.
Add extension that allows to flush connections from CT by specifying fields that the connections should be matched against. This allows to match only some fields of the connection e.g. source address for orig direction. 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 'ofproto/ofproto.c')
-rw-r--r--ofproto/ofproto.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 3a527683c..17f636ed9 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -42,6 +42,7 @@
#include "openvswitch/meta-flow.h"
#include "openvswitch/ofp-actions.h"
#include "openvswitch/ofp-bundle.h"
+#include "openvswitch/ofp-ct.h"
#include "openvswitch/ofp-errors.h"
#include "openvswitch/ofp-match.h"
#include "openvswitch/ofp-msgs.h"
@@ -934,7 +935,30 @@ handle_nxt_ct_flush_zone(struct ofconn *ofconn, const struct ofp_header *oh)
uint16_t zone = ntohs(nzi->zone_id);
if (ofproto->ofproto_class->ct_flush) {
- ofproto->ofproto_class->ct_flush(ofproto, &zone);
+ ofproto->ofproto_class->ct_flush(ofproto, &zone, NULL);
+ } else {
+ return EOPNOTSUPP;
+ }
+
+ return 0;
+}
+
+static enum ofperr
+handle_nxt_ct_flush(struct ofconn *ofconn, const struct ofp_header *oh)
+{
+ struct ofproto *ofproto = ofconn_get_ofproto(ofconn);
+ struct ofp_ct_match match = {0};
+ bool with_zone = false;
+ uint16_t zone_id = 0;
+
+ enum ofperr error = ofp_ct_match_decode(&match, &with_zone, &zone_id, oh);
+ if (error) {
+ return error;
+ }
+
+ if (ofproto->ofproto_class->ct_flush) {
+ ofproto->ofproto_class->ct_flush(ofproto, with_zone ? &zone_id : NULL,
+ &match);
} else {
return EOPNOTSUPP;
}
@@ -8787,6 +8811,9 @@ handle_single_part_openflow(struct ofconn *ofconn, const struct ofp_header *oh,
case OFPTYPE_CT_FLUSH_ZONE:
return handle_nxt_ct_flush_zone(ofconn, oh);
+ case OFPTYPE_CT_FLUSH:
+ return handle_nxt_ct_flush(ofconn, oh);
+
case OFPTYPE_HELLO:
case OFPTYPE_ERROR:
case OFPTYPE_FEATURES_REPLY: