bbaaef
From b4ddab6aa4d08a04eb7b55337b3fbdcc30b916a6 Mon Sep 17 00:00:00 2001
bbaaef
Message-Id: <b4ddab6aa4d08a04eb7b55337b3fbdcc30b916a6.1583175283.git.lorenzo.bianconi@redhat.com>
bbaaef
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
bbaaef
Date: Thu, 13 Feb 2020 17:49:37 +0100
bbaaef
Subject: [PATCH 1/2] pinctrl: fix IP buffering with connection-tracking
bbaaef
bbaaef
Whenever we need to reinject an IP packet buffered during L2 address
bbaaef
resolution we need to preserve ovs ofport in order to let ovs
bbaaef
connection tracking to properly SNAT/DNAT the packet.
bbaaef
Do not overwrite the MFF_IN_PORT in consider_port_binding routine
bbaaef
bbaaef
Suggested-by: Numan Siddique <numans@ovn.org>
bbaaef
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
bbaaef
Acked-by: Dumitru Ceara <dceara@redhat.com>
bbaaef
Signed-off-by: Numan Siddique <numans@ovn.org>
bbaaef
---
bbaaef
 ovn/controller/physical.c | 1 -
bbaaef
 ovn/controller/pinctrl.c  | 5 ++++-
bbaaef
 2 files changed, 4 insertions(+), 2 deletions(-)
bbaaef
bbaaef
diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
bbaaef
index 8f8a5ba27..95cbaba49 100644
bbaaef
--- a/ovn/controller/physical.c
bbaaef
+++ b/ovn/controller/physical.c
bbaaef
@@ -893,7 +893,6 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
bbaaef
         for (int i = 0; i < MFF_N_LOG_REGS; i++) {
bbaaef
             put_load(0, MFF_LOG_REG0 + i, 0, 32, ofpacts_p);
bbaaef
         }
bbaaef
-        put_load(0, MFF_IN_PORT, 0, 16, ofpacts_p);
bbaaef
         put_resubmit(OFTABLE_LOG_INGRESS_PIPELINE, ofpacts_p);
bbaaef
         clone = ofpbuf_at_assert(ofpacts_p, clone_ofs, sizeof *clone);
bbaaef
         ofpacts_p->header = clone;
bbaaef
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
bbaaef
index 57e450c26..01a1bcbe0 100644
bbaaef
--- a/ovn/controller/pinctrl.c
bbaaef
+++ b/ovn/controller/pinctrl.c
bbaaef
@@ -548,6 +548,7 @@ set_actions_and_enqueue_msg(struct rconn *swconn,
bbaaef
 
bbaaef
 struct buffer_info {
bbaaef
     struct ofpbuf ofpacts;
bbaaef
+    ofp_port_t ofp_port;
bbaaef
     struct dp_packet *p;
bbaaef
 };
bbaaef
 
bbaaef
@@ -618,6 +619,8 @@ buffered_push_packet(struct buffered_packets *bp,
bbaaef
     ofpbuf_init(&bi->ofpacts, 4096);
bbaaef
 
bbaaef
     reload_metadata(&bi->ofpacts, md);
bbaaef
+    bi->ofp_port = md->flow.in_port.ofp_port;
bbaaef
+
bbaaef
     struct ofpact_resubmit *resubmit = ofpact_put_RESUBMIT(&bi->ofpacts);
bbaaef
     resubmit->in_port = OFPP_CONTROLLER;
bbaaef
     resubmit->table_id = OFTABLE_REMOTE_OUTPUT;
bbaaef
@@ -652,7 +655,7 @@ buffered_send_packets(struct rconn *swconn, struct buffered_packets *bp,
bbaaef
             .ofpacts = bi->ofpacts.data,
bbaaef
             .ofpacts_len = bi->ofpacts.size,
bbaaef
         };
bbaaef
-        match_set_in_port(&po.flow_metadata, OFPP_CONTROLLER);
bbaaef
+        match_set_in_port(&po.flow_metadata, bi->ofp_port);
bbaaef
         queue_msg(swconn, ofputil_encode_packet_out(&po, proto));
bbaaef
 
bbaaef
         ofpbuf_uninit(&bi->ofpacts);
bbaaef
-- 
bbaaef
2.24.1
bbaaef