On Wed, Jun 22, 2022 at 04:13:43PM +0200, Claudio Jeker wrote:
> Do not leak the address family specific struct kroute into bgpctl if there
> is struct kroute_full which is address family independent.
> The result is mostly minus because the code no longer needs address family
> specific code paths. This changes 'bgpctl show nexthop' but not its output.
>
> OK?
This reads fine.
ok
One thing I noticed while comparing the code paths: should the KAME hack
in log_in6addr() not be synced with route/show.c similar to the recent
change in sa2addr()?
Index: util.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/util.c,v
retrieving revision 1.66
diff -u -p -r1.66 util.c
--- util.c 19 Jun 2022 10:30:10 -0000 1.66
+++ util.c 22 Jun 2022 14:32:39 -0000
@@ -66,8 +66,10 @@ log_in6addr(const struct in6_addr *addr)
#ifdef __KAME__
/* XXX thanks, KAME, for this ugliness... adopted from route/show.c */
- if (IN6_IS_ADDR_LINKLOCAL(&sa_in6.sin6_addr) ||
- IN6_IS_ADDR_MC_LINKLOCAL(&sa_in6.sin6_addr)) {
+ if ((IN6_IS_ADDR_LINKLOCAL(&sa_in6.sin6_addr) ||
+ IN6_IS_ADDR_MC_LINKLOCAL(&sa_in6.sin6_addr) ||
+ IN6_IS_ADDR_MC_INTFACELOCAL(&sa_in6.sin6_addr)) &&
+ sa_in6.sin6_scope_id == 0) {
uint16_t tmp16;
memcpy(&tmp16, &sa_in6.sin6_addr.s6_addr[2], sizeof(tmp16));
sa_in6.sin6_scope_id = ntohs(tmp16);