[ovs-dev] [PATCH 1/2] ovs-router: ignore IPv6 source addresses for IPv4 routes
Thadeu Lima de Souza Cascardo
cascardo at redhat.com
Sun Jul 24 16:07:26 UTC 2016
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 at redhat.com>
---
lib/ovs-router.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/ovs-router.c b/lib/ovs-router.c
index 90e2f82..685e1ad 100644
--- a/lib/ovs-router.c
+++ b/lib/ovs-router.c
@@ -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);
--
2.7.4
More information about the dev
mailing list