Blob Blame History Raw
From b4ddab6aa4d08a04eb7b55337b3fbdcc30b916a6 Mon Sep 17 00:00:00 2001
Message-Id: <b4ddab6aa4d08a04eb7b55337b3fbdcc30b916a6.1583175283.git.lorenzo.bianconi@redhat.com>
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date: Thu, 13 Feb 2020 17:49:37 +0100
Subject: [PATCH 1/2] pinctrl: fix IP buffering with connection-tracking

Whenever we need to reinject an IP packet buffered during L2 address
resolution we need to preserve ovs ofport in order to let ovs
connection tracking to properly SNAT/DNAT the packet.
Do not overwrite the MFF_IN_PORT in consider_port_binding routine

Suggested-by: Numan Siddique <numans@ovn.org>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
---
 ovn/controller/physical.c | 1 -
 ovn/controller/pinctrl.c  | 5 ++++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
index 8f8a5ba27..95cbaba49 100644
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -893,7 +893,6 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
         for (int i = 0; i < MFF_N_LOG_REGS; i++) {
             put_load(0, MFF_LOG_REG0 + i, 0, 32, ofpacts_p);
         }
-        put_load(0, MFF_IN_PORT, 0, 16, ofpacts_p);
         put_resubmit(OFTABLE_LOG_INGRESS_PIPELINE, ofpacts_p);
         clone = ofpbuf_at_assert(ofpacts_p, clone_ofs, sizeof *clone);
         ofpacts_p->header = clone;
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index 57e450c26..01a1bcbe0 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -548,6 +548,7 @@ set_actions_and_enqueue_msg(struct rconn *swconn,
 
 struct buffer_info {
     struct ofpbuf ofpacts;
+    ofp_port_t ofp_port;
     struct dp_packet *p;
 };
 
@@ -618,6 +619,8 @@ buffered_push_packet(struct buffered_packets *bp,
     ofpbuf_init(&bi->ofpacts, 4096);
 
     reload_metadata(&bi->ofpacts, md);
+    bi->ofp_port = md->flow.in_port.ofp_port;
+
     struct ofpact_resubmit *resubmit = ofpact_put_RESUBMIT(&bi->ofpacts);
     resubmit->in_port = OFPP_CONTROLLER;
     resubmit->table_id = OFTABLE_REMOTE_OUTPUT;
@@ -652,7 +655,7 @@ buffered_send_packets(struct rconn *swconn, struct buffered_packets *bp,
             .ofpacts = bi->ofpacts.data,
             .ofpacts_len = bi->ofpacts.size,
         };
-        match_set_in_port(&po.flow_metadata, OFPP_CONTROLLER);
+        match_set_in_port(&po.flow_metadata, bi->ofp_port);
         queue_msg(swconn, ofputil_encode_packet_out(&po, proto));
 
         ofpbuf_uninit(&bi->ofpacts);
-- 
2.24.1