[PATCH] IPv4 over IPv6 nexthop support on FreeBSD

Luiz Amaral email at luiz.eng.br
Mon Apr 17 16:46:13 CEST 2023


Hello Ondrej,

Did you have a chance to check out the patch? I am happy to adjust it if 
needed.

Luiz

On 20/02/2023 04.33, Ondrej Zajicek wrote:
> 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)
>



More information about the Bird-users mailing list