]> git.proxmox.com Git - mirror_ovs.git/commitdiff
ovs-router: Ignore IPv6 source addresses for IPv4 routes.
authorThadeu Lima de Souza Cascardo <cascardo@redhat.com>
Sun, 24 Jul 2016 16:07:26 +0000 (13:07 -0300)
committerBen Pfaff <blp@ovn.org>
Wed, 27 Jul 2016 20:46:33 +0000 (13:46 -0700)
Though this should not happen when we have another address on the device that is
IPv4 mapped, we should prevent adding a routing entry to IPv4 with an IPv6
source address.

This entry has been observed when the addresses list was out of date.

Cached: 172.16.10.1/32 dev br3 SRC fe80::c4d0:14ff:feb1:b54b
Cached: 172.16.10.0/24 dev br3 SRC fe80::c4d0:14ff:feb1:b54b

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
lib/ovs-router.c

index 90e2f828d73819c56dd9de22f3b411c7fb755d58..685e1ad3216df57a63e0a8b0027c33dbd029c289 100644 (file)
@@ -136,6 +136,7 @@ get_src_addr(const struct in6_addr *ip6_dst,
     struct in6_addr *mask, *addr6;
     int err, n_in6, i, max_plen = -1;
     struct netdev *dev;
+    bool is_ipv4;
 
     err = netdev_open(output_bridge, NULL, &dev);
     if (err) {
@@ -147,10 +148,16 @@ get_src_addr(const struct in6_addr *ip6_dst,
         goto out;
     }
 
+    is_ipv4 = IN6_IS_ADDR_V4MAPPED(ip6_dst);
+
     for (i = 0; i < n_in6; i++) {
         struct in6_addr a1, a2;
         int mask_bits;
 
+        if (is_ipv4 && !IN6_IS_ADDR_V4MAPPED(&addr6[i])) {
+            continue;
+        }
+
         a1 = ipv6_addr_bitand(ip6_dst, &mask[i]);
         a2 = ipv6_addr_bitand(&addr6[i], &mask[i]);
         mask_bits = bitmap_count1(ALIGNED_CAST(const unsigned long *, &mask[i]), 128);