summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorwenxu <wenxu@chinatelecom.cn>2022-04-01 11:02:28 -0400
committerIlya Maximets <i.maximets@ovn.org>2022-05-25 21:11:32 +0200
commit482abeae570ce551d808f345caaf5b3c28bcb237 (patch)
treefbc874dfa18a9a7e3051c2fa20f1e2f6e49981a9 /ofproto
parentc5bcbd58d6d1f071a9dfde643b6bd61ea0f60883 (diff)
downloadopenvswitch-482abeae570ce551d808f345caaf5b3c28bcb237.tar.gz
ofproto-dpif-xlate: Fix netdev native tunnel neigh discovery spa.
During native tunnel encapsulation process, on tunnel neighbor cache miss OVS sends an arp/nd request. Currently, tunnel source is used as arp spa. Find the spa which has the same subnet 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> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif-xlate.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 6d6f2f6a9..7dfd8e9ef 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -3681,14 +3681,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;
}