diff mbox series

[ovs-dev,v2,2/2] ofproto-dpif-xlate: Fix netdev native tunnel neigh discovery spa

Message ID 1648825348-7487-2-git-send-email-wenx05124561@163.com
State Accepted
Commit 482abeae570ce551d808f345caaf5b3c28bcb237
Headers show
Series [ovs-dev,v2,1/2] ovs-router: expose the ovs_router_get_netdev_source_address function | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

wenxu April 1, 2022, 3:02 p.m. UTC
From: wenxu <wenxu@chinatelecom.cn>

netdev native tunnel encap process, when tunnel neighbor cache miss,
send arp/nd request. Before spa use tunnel source, change to:
find the spa which have the same subset with the nexthop of tunnel dst
on  egress port, if false, use the tunnel src as spa.

For example:
tunnel src is a vip with 10.0.0.7/32, tunnel dst is 10.0.1.7
the br-phy with address 192.168.0.7/24 and the default gateway is 192.168.0.1
So the spa of arp request for 192.168.0.1 should be 192.168.0.7 but not 10.0.0.7

Signed-off-by: wenxu <wenxu@chinatelecom.cn>
---
 ofproto/ofproto-dpif-xlate.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

Comments

Eelco Chaudron April 8, 2022, 7:22 a.m. UTC | #1
> netdev native tunnel encap process, when tunnel neighbor cache miss,
> send arp/nd request. Before spa use tunnel source, change to:
> find the spa which have the same subset with the nexthop of tunnel dst
> on  egress port, if false, use the tunnel src as spa.
>    For example:
> tunnel src is a vip with 10.0.0.7/32, tunnel dst is 10.0.1.7
> the br-phy with address 192.168.0.7/24 and the default gateway is 192.168.0.1
> So the spa of arp request for 192.168.0.1 should be 192.168.0.7 but not 10.0.0.7
>    Signed-off-by: wenxu <wenxu@chinatelecom.cn>

Changes look good to me.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Ilya Maximets May 26, 2022, 9:54 a.m. UTC | #2
On 4/8/22 09:22, Eelco Chaudron wrote:
>> netdev native tunnel encap process, when tunnel neighbor cache miss,
>> send arp/nd request. Before spa use tunnel source, change to:
>> find the spa which have the same subset with the nexthop of tunnel dst
>> on  egress port, if false, use the tunnel src as spa.
>>    For example:
>> tunnel src is a vip with 10.0.0.7/32, tunnel dst is 10.0.1.7
>> the br-phy with address 192.168.0.7/24 and the default gateway is 192.168.0.1
>> So the spa of arp request for 192.168.0.1 should be 192.168.0.7 but not 10.0.0.7
>>    Signed-off-by: wenxu <wenxu@chinatelecom.cn>
> 
> Changes look good to me.
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> 

Applied to master and branch-2.17.  Thanks!

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index cc9c1c6..f287918 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -3673,14 +3673,27 @@  native_tunnel_output(struct xlate_ctx *ctx, const struct xport *xport,
 
     err = tnl_neigh_lookup(out_dev->xbridge->name, &d_ip6, &dmac);
     if (err) {
+        struct in6_addr nh_s_ip6 = in6addr_any;
+
         xlate_report(ctx, OFT_DETAIL,
                      "neighbor cache miss for %s on bridge %s, "
                      "sending %s request",
                      buf_dip6, out_dev->xbridge->name, d_ip ? "ARP" : "ND");
+
+        err = ovs_router_get_netdev_source_address(&d_ip6,
+                                                   out_dev->xbridge->name,
+                                                   &nh_s_ip6);
+        if (err) {
+            nh_s_ip6 = s_ip6;
+        }
+
         if (d_ip) {
-            tnl_send_arp_request(ctx, out_dev, smac, s_ip, d_ip);
+            ovs_be32 nh_s_ip;
+
+            nh_s_ip = in6_addr_get_mapped_ipv4(&nh_s_ip6);
+            tnl_send_arp_request(ctx, out_dev, smac, nh_s_ip, d_ip);
         } else {
-            tnl_send_nd_request(ctx, out_dev, smac, &s_ip6, &d_ip6);
+            tnl_send_nd_request(ctx, out_dev, smac, &nh_s_ip6, &d_ip6);
         }
         return err;
     }