svn commit: r358569 - head/sys/netinet6

Bjoern A. Zeeb bz at FreeBSD.org
Tue Mar 3 09:50:34 UTC 2020


Author: bz
Date: Tue Mar  3 09:50:33 2020
New Revision: 358569
URL: https://svnweb.freebsd.org/changeset/base/358569

Log:
  in6_fib: return nh_ia in the ext interface as we do for IPv4
  
  Like for IPv4 add nh_ia to the ext interface and return rt_ifa
  in order to be used for, e.g., packet/octets accounting purposes.
  
  Reviewed by:	melifaro
  MFC after:	1 week
  Sponsored by:	Netflix
  Differential Revision:	https://reviews.freebsd.org/D23873

Modified:
  head/sys/netinet6/in6_fib.c
  head/sys/netinet6/in6_fib.h

Modified: head/sys/netinet6/in6_fib.c
==============================================================================
--- head/sys/netinet6/in6_fib.c	Tue Mar  3 09:45:16 2020	(r358568)
+++ head/sys/netinet6/in6_fib.c	Tue Mar  3 09:50:33 2020	(r358569)
@@ -75,6 +75,8 @@ static void fib6_rte_to_nh_basic(struct rtentry *rte, 
 static struct ifnet *fib6_get_ifaifp(struct rtentry *rte);
 #define RNTORT(p)	((struct rtentry *)(p))
 
+#define	ifatoia6(ifa)	((struct in6_ifaddr *)(ifa))
+
 CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst);
 
 /*
@@ -153,6 +155,7 @@ fib6_rte_to_nh_extended(struct rtentry *rte, const str
 	gw = (struct sockaddr_in6 *)rt_key(rte);
 	if (IN6_IS_ADDR_UNSPECIFIED(&gw->sin6_addr))
 		pnh6->nh_flags |= NHF_DEFAULT;
+	pnh6->nh_ia = ifatoia6(rte->rt_ifa);
 }
 
 /*

Modified: head/sys/netinet6/in6_fib.h
==============================================================================
--- head/sys/netinet6/in6_fib.h	Tue Mar  3 09:45:16 2020	(r358568)
+++ head/sys/netinet6/in6_fib.h	Tue Mar  3 09:50:33 2020	(r358569)
@@ -41,14 +41,15 @@ struct nhop6_basic {
 	struct in6_addr	nh_addr;	/* GW/DST IPv4 address */
 };
 
-/* Does not differ from nhop6_basic */
+/* Extended nexthop info used for control protocols. */
 struct nhop6_extended {
 	struct ifnet	*nh_ifp;	/* Logical egress interface */
+	struct in6_ifaddr *nh_ia;	/* Associated address. */
 	uint16_t	nh_mtu;		/* nexthop mtu */
 	uint16_t	nh_flags;	/* nhop flags */
 	uint8_t		spare[4];
 	struct in6_addr	nh_addr;	/* GW/DST IPv6 address */
-	uint64_t	spare2[2];
+	uint64_t	spare2[1];
 };
 
 int fib6_lookup_nh_basic(uint32_t fibnum, const struct in6_addr *dst,


More information about the svn-src-all mailing list