3 Aug 2007 16:15
[quagga-dev 5017] Re: A patch for 0.99.8 to fix IPv6 PtP static routes
Andrew J. Schorr <aschorr <at> telemetry-investments.com>
2007-08-03 14:15:35 GMT
2007-08-03 14:15:35 GMT
On Fri, Aug 03, 2007 at 03:41:16PM +0200, Emmanuel Vize wrote:
> I am currently merging my Quagga version with the 0.99.8 release.
> I found one problem: Static IPv6 routes in 6in6 tunnels (PtP) are not
> working anymore, the routes via the other endpoint of the interface are
> inactive.
> I observe this on Linux.
>
> I would suggest the patch below:
>
>
> --- rt_netlink.c.orig Fri Aug 3 14:27:05 2007
> +++ rt_netlink.c Fri Aug 3 15:20:51 2007
> <at> <at> -712,12 +712,10 <at> <at>
> addr = (tb[IFA_LOCAL] ? RTA_DATA(tb[IFA_LOCAL]) : NULL);
>
> /* is there a peer address? */
> - /* N.B. I do not understand why the memcmp compares 4 bytes regardless
> - of address family, but this is exactly how it appears in
> - print_addrinfo. I wonder if it should be RTA_PAYLOAD(tb[IFA_ADDRESS])
> - instead of 4... */
> if (tb[IFA_ADDRESS] &&
> - memcmp(RTA_DATA(tb[IFA_ADDRESS]), RTA_DATA(tb[IFA_LOCAL]), 4))
> + memcmp(RTA_DATA(tb[IFA_ADDRESS]),RTA_DATA(tb[IFA_LOCAL]),
> + ifa->ifa_family == AF_INET ? 4 :
> + ifa->ifa_family == AF_INET6 ? 16 : /* fall back*/ 4))
> {
> broad = RTA_DATA(tb[IFA_ADDRESS]);
> SET_FLAG (flags, ZEBRA_IFA_PEER);
>
>
>
> With this patch, it is working much better.
>
> If no objections, I will commit next week.
I copied this code originally from iproute2/ip/ipaddress.c:print_addrinfo
(as indicated in comment). The code there looks like this:
if (rta_tb[IFA_LOCAL]) {
fprintf(fp, "%s", rt_addr_n2a(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_LOCAL]),
RTA_DATA(rta_tb[IFA_LOCAL]),
abuf, sizeof(abuf)));
if (rta_tb[IFA_ADDRESS] == NULL ||
memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]), 4) == 0) {
fprintf(fp, "/%d ", ifa->ifa_prefixlen);
} else {
fprintf(fp, " peer %s/%d ",
rt_addr_n2a(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_ADDRESS]),
RTA_DATA(rta_tb[IFA_ADDRESS]),
abuf, sizeof(abuf)),
ifa->ifa_prefixlen);
}
}
It always seemed strange to me that the 3rd argument to memcmp is 4
(as I also indicated in the comment), but your patch also seems strange
to me: wy do you have
ifa->ifa_family == AF_INET ? 4 :
ifa->ifa_family == AF_INET6 ? 16 : /* fall back*/ 4))
instead of something more general like RTA_PAYLOAD(tb[IFA_ADDRESS])?
And just out of curiosity, on the system that shows this bug, does
'/sbin/ip addr ls' give incorrect results?
Regards,
Andy
RSS Feed