[PATCH] IPv4 over IPv6 nexthop support on FreeBSD

Ondrej Zajicek santiago at crfreenet.org
Mon Feb 20 04:33:54 CET 2023


On Sat, Feb 18, 2023 at 03:41:31PM +0100, Luiz Amaral wrote:
> Hello,
> 
> While experimenting in FreeBSD 13.1 with IPv4 over IPv6 nexthop routes, I
> realized that BIRD was unable to read routes from the kernel as well as
> export routes to the kernel. The support for it was implemented in FreeBSD
> 13.1 [1].
> 
> I have attached a patch that made it work for me on FreeBSD 13.1, both
> importing and exporting to/from kernel. I believe the patch will still need
> some work, as from a quick look, OpenBSD still has no support for it. I'm
> happy to implement any suggested improvements and send a v2 of it.

Hello

This looks particularly simple. Will check that.

> [1] https://reviews.freebsd.org/D30398

> diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
> index 1f793293..92f8c837 100644
> --- a/sysdep/bsd/krt-sock.c
> +++ b/sysdep/bsd/krt-sock.c
> @@ -314,6 +314,10 @@ krt_send_route(struct krt_proto *p, int cmd, rte *e)
>        if (ipa_is_link_local(gw))
>  	_I0(gw) = 0xfe800000 | (i->index & 0x0000ffff);
>  
> +      if (ipa_is_ip6(gw)) {
> +        af = AF_INET6;
> +      }
> +
>        sockaddr_fill(&gate, af, gw, NULL, 0);
>        msg.rtm.rtm_flags |= RTF_GATEWAY;
>        msg.rtm.rtm_addrs |= RTA_GATEWAY;
> @@ -469,7 +473,7 @@ krt_read_route(struct ks_msg *msg, struct krt_proto *p, int scan)
>  
>    idst  = ipa_from_sa(&dst);
>    imask = ipa_from_sa(&mask);
> -  igate = (gate.sa.sa_family == dst.sa.sa_family) ? ipa_from_sa(&gate) : IPA_NONE;
> +  igate = ipa_from_sa(&gate);
>  
>  #ifdef KRT_SHARED_SOCKET
>    if (!scan)


-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."


More information about the Bird-users mailing list