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