Hello Ondrej,
Thanks for the merge. I did a quick test with the merged code on FreeBSD
13.2 and all worked well.
While testing the same feature with Netlink as suggested by Marek, I
noticed that the import of routes from kernel to BIRD was broken.
I attached a patch that fixed the issue with Netlink for me. I believe
it should be safe to handle RTA_VIA on non-MPLS kernels as rtnetlink(7)
on Linux lists it as "Gateway in different AF" and rtnetlink(4) on
FreeBSD lists it as "IPv6 nexthop address for IPv4 route".
Luiz
On 21/04/2023 03.07, Ondrej Zajicek wrote:
On Mon, Apr 17, 2023 at 04:46:13PM +0200, Luiz Amaral wrote:
Hello Ondrej,
Did you have a chance to check out the patch? I am happy to adjust it if
needed.
Hello
Thanks for a notice, i just merged that (with minor modification):
https://gitlab.nic.cz/labs/bird/-/commit/d61505b039bf0aa6697e28b2a4e07907c89ba1fb
I didn't test the feature, as our FreeBSD VM is still at 13.0
(bsd-cloud-image.org does not offer never version), but it seems safe.
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index 7f0d4736..e3298a0f 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -485,7 +485,6 @@ static inline ip_addr rta_get_ipa(struct rtattr *a)
return ipa_from_ip6(rta_get_ip6(a));
}
-#ifdef HAVE_MPLS_KERNEL
static inline ip_addr rta_get_via(struct rtattr *a)
{
struct rtvia *v = RTA_DATA(a);
@@ -496,6 +495,7 @@ static inline ip_addr rta_get_via(struct rtattr *a)
return IPA_NONE;
}
+#ifdef HAVE_MPLS_KERNEL
static u32 rta_mpls_stack[MPLS_MAX_LABEL_STACK];
static inline int rta_get_mpls(struct rtattr *a, u32 *stack)
{
@@ -763,10 +763,8 @@ nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, const net_addr
if (a[RTA_FLOW])
s->rta_flow = rta_get_u32(a[RTA_FLOW]);
-#ifdef HAVE_MPLS_KERNEL
if (a[RTA_VIA])
rv->gw = rta_get_via(a[RTA_VIA]);
-#endif
if (nh->rtnh_flags & RTNH_F_ONLINK)
rv->flags |= RNF_ONLINK;
@@ -1659,10 +1657,8 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
if (a[RTA_GATEWAY])
ra->nh.gw = rta_get_ipa(a[RTA_GATEWAY]);
-#ifdef HAVE_MPLS_KERNEL
if (a[RTA_VIA])
ra->nh.gw = rta_get_via(a[RTA_VIA]);
-#endif
if (i->rtm_flags & RTNH_F_ONLINK)
ra->nh.flags |= RNF_ONLINK;