]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BSD: IPv4 over IPv6 nexthop support on FreeBSD
authorLuiz Amaral <email@luiz.eng.br>
Thu, 20 Apr 2023 23:37:30 +0000 (01:37 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Fri, 21 Apr 2023 00:03:31 +0000 (02:03 +0200)
The support for IPv4 routes with IPv6 nexthops was implemented in FreeBSD
13.1, this patch allows to import and export such routes from/to kernel.

Minor change from committer.

sysdep/bsd/krt-sock.c

index 1f793293e9d5355259775cf2cb91630c5b76d6ab..d13e20a3efc93436de4b8b10e52df05ad8ecc822 100644 (file)
@@ -314,7 +314,7 @@ krt_send_route(struct krt_proto *p, int cmd, rte *e)
       if (ipa_is_link_local(gw))
        _I0(gw) = 0xfe800000 | (i->index & 0x0000ffff);
 
-      sockaddr_fill(&gate, af, gw, NULL, 0);
+      sockaddr_fill(&gate, (ipa_is_ip4(gw) ? AF_INET : AF_INET6), gw, NULL, 0);
       msg.rtm.rtm_flags |= RTF_GATEWAY;
       msg.rtm.rtm_addrs |= RTA_GATEWAY;
       break;
@@ -469,7 +469,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)