773311
From 754d5581fa9d5de97f7c2acf8c2900e105f588c9 Mon Sep 17 00:00:00 2001
773311
Message-Id: <754d5581fa9d5de97f7c2acf8c2900e105f588c9.1590585469.git.lorenzo.bianconi@redhat.com>
773311
In-Reply-To: <d9ed450713eda62af1bec5009694b2d206c9f435.1590585469.git.lorenzo.bianconi@redhat.com>
773311
References: <d9ed450713eda62af1bec5009694b2d206c9f435.1590585469.git.lorenzo.bianconi@redhat.com>
773311
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
773311
Date: Wed, 20 May 2020 22:01:16 +0200
773311
Subject: [PATCH ovn 2/3] controller: fix ip buffering with static routes
773311
773311
When the arp request is sent to a gw router and not to the final
773311
destination of the packet buffered_packets_map needs to be updated using
773311
next-hop ip address and not the destionation one.
773311
773311
Fixes: 2e5cdb4b1392 ("OVN: add buffering support for ip packets")
773311
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
773311
---
773311
 controller/pinctrl.c | 12 ++++++------
773311
 1 file changed, 6 insertions(+), 6 deletions(-)
773311
773311
--- a/controller/pinctrl.c
773311
+++ b/controller/pinctrl.c
773311
@@ -1378,8 +1378,7 @@ pinctrl_find_buffered_packets(const stru
773311
 
773311
 /* Called with in the pinctrl_handler thread context. */
773311
 static int
773311
-pinctrl_handle_buffered_packets(const struct flow *ip_flow,
773311
-                                struct dp_packet *pkt_in,
773311
+pinctrl_handle_buffered_packets(struct dp_packet *pkt_in,
773311
                                 const struct match *md, bool is_arp)
773311
     OVS_REQUIRES(pinctrl_mutex)
773311
 {
773311
@@ -1388,9 +1387,10 @@ pinctrl_handle_buffered_packets(const st
773311
     struct in6_addr addr;
773311
 
773311
     if (is_arp) {
773311
-        addr = in6_addr_mapped_ipv4(ip_flow->nw_dst);
773311
+        addr = in6_addr_mapped_ipv4(htonl(md->flow.regs[0]));
773311
     } else {
773311
-        addr = ip_flow->ipv6_dst;
773311
+        ovs_be128 ip6 = hton128(flow_get_xxreg(&md->flow, 0));
773311
+        memcpy(&addr, &ip6, sizeof addr);
773311
     }
773311
 
773311
     uint32_t hash = hash_bytes(&addr, sizeof addr, 0);
773311
@@ -1431,7 +1431,7 @@ pinctrl_handle_arp(struct rconn *swconn,
773311
     }
773311
 
773311
     ovs_mutex_lock(&pinctrl_mutex);
773311
-    pinctrl_handle_buffered_packets(ip_flow, pkt_in, md, true);
773311
+    pinctrl_handle_buffered_packets(pkt_in, md, true);
773311
     ovs_mutex_unlock(&pinctrl_mutex);
773311
 
773311
     /* Compose an ARP packet. */
773311
@@ -5278,7 +5278,7 @@ pinctrl_handle_nd_ns(struct rconn *swcon
773311
     }
773311
 
773311
     ovs_mutex_lock(&pinctrl_mutex);
773311
-    pinctrl_handle_buffered_packets(ip_flow, pkt_in, md, false);
773311
+    pinctrl_handle_buffered_packets(pkt_in, md, false);
773311
     ovs_mutex_unlock(&pinctrl_mutex);
773311
 
773311
     uint64_t packet_stub[128 / 8];