Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Apr 2020 19:28:56 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r360475 - in head/sys: net netinet6
Message-ID:  <202004291928.03TJSua8036371@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Wed Apr 29 19:28:56 2020
New Revision: 360475
URL: https://svnweb.freebsd.org/changeset/base/360475

Log:
  Add nhop to the ifa_rtrequest() callback.
  
  With the upcoming multipath changes described in D24141,
   rt->rt_nhop can potentially point to a nexthop group instead of
   an individual nhop.
  To simplify caller handling of such cases, change ifa_rtrequest() callback
   to pass changed nhop directly.
  
  Differential Revision:	https://reviews.freebsd.org/D24604

Modified:
  head/sys/net/if_var.h
  head/sys/net/route.c
  head/sys/netinet6/nd6.c

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Wed Apr 29 18:59:37 2020	(r360474)
+++ head/sys/net/if_var.h	Wed Apr 29 19:28:56 2020	(r360475)
@@ -61,6 +61,7 @@
  */
 
 struct	rtentry;		/* ifa_rtrequest */
+struct	nhop_object;		/* ifa_rtrequest */
 struct	rt_addrinfo;		/* ifa_rtrequest */
 struct	socket;
 struct	carp_if;
@@ -551,7 +552,8 @@ struct ifaddr {
 	struct	carp_softc *ifa_carp;	/* pointer to CARP data */
 	CK_STAILQ_ENTRY(ifaddr) ifa_link;	/* queue macro glue */
 	void	(*ifa_rtrequest)	/* check or clean routes (+ or -)'d */
-		(int, struct rtentry *, struct rt_addrinfo *);
+		(int, struct rtentry *, struct nhop_object *,
+		 struct rt_addrinfo *);
 	u_short	ifa_flags;		/* mostly rt_flags for cloning */
 #define	IFA_ROUTE	RTF_UP		/* route installed */
 #define	IFA_RTSELF	RTF_HOST	/* loopback route to self installed */

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c	Wed Apr 29 18:59:37 2020	(r360474)
+++ head/sys/net/route.c	Wed Apr 29 19:28:56 2020	(r360475)
@@ -1239,7 +1239,7 @@ rt_notifydelete(struct rtentry *rt, struct rt_addrinfo
 	 */
 	ifa = rt->rt_ifa;
 	if (ifa != NULL && ifa->ifa_rtrequest != NULL)
-		ifa->ifa_rtrequest(RTM_DELETE, rt, info);
+		ifa->ifa_rtrequest(RTM_DELETE, rt, rt->rt_nhop, info);
 
 	/*
 	 * One more rtentry floating around that is not
@@ -1761,7 +1761,7 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in
 	 * allow it to do that as well.
 	 */
 	if (ifa->ifa_rtrequest)
-		ifa->ifa_rtrequest(RTM_ADD, rt, info);
+		ifa->ifa_rtrequest(RTM_ADD, rt, rt->rt_nhop, info);
 
 	/*
 	 * actually return a resultant rtentry and
@@ -1886,7 +1886,8 @@ change_route(struct rib_head *rnh, struct rt_addrinfo 
 	if (info->rti_ifa != NULL && info->rti_ifa != rt->rt_ifa &&
 	    rt->rt_ifa != NULL) {
 		if (rt->rt_ifa->ifa_rtrequest != NULL)
-			rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, info);
+			rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, rt->rt_nhop,
+			info);
 		ifa_free(rt->rt_ifa);
 		rt->rt_ifa = NULL;
 	}
@@ -1910,7 +1911,7 @@ change_route(struct rib_head *rnh, struct rt_addrinfo 
 	rt->rt_flags |= info->rti_flags & RTF_FMASK;
 
 	if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest != NULL)
-	       rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, info);
+	       rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, nh, info);
 
 	/* Alter route MTU if necessary */
 	if (rt->rt_ifp != NULL) {

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Wed Apr 29 18:59:37 2020	(r360474)
+++ head/sys/netinet6/nd6.c	Wed Apr 29 19:28:56 2020	(r360475)
@@ -138,7 +138,8 @@ static void nd6_free_redirect(const struct llentry *);
 static void nd6_llinfo_timer(void *);
 static void nd6_llinfo_settimer_locked(struct llentry *, long);
 static void clear_llinfo_pqueue(struct llentry *);
-static void nd6_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
+static void nd6_rtrequest(int, struct rtentry *, struct nhop_object *,
+    struct rt_addrinfo *);
 static int nd6_resolve_slow(struct ifnet *, int, struct mbuf *,
     const struct sockaddr_in6 *, u_char *, uint32_t *, struct llentry **);
 static int nd6_need_cache(struct ifnet *);
@@ -1562,13 +1563,12 @@ nd6_free_redirect(const struct llentry *ln)
  * processing.
  */
 void
-nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info)
+nd6_rtrequest(int req, struct rtentry *rt, struct nhop_object *nh,
+    struct rt_addrinfo *info)
 {
 	struct sockaddr_in6 *gateway;
 	struct nd_defrouter *dr;
-	struct nhop_object *nh;
 
-	nh = rt->rt_nhop;
 	gateway = &nh->gw6_sa;
 
 	switch (req) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004291928.03TJSua8036371>