From owner-svn-src-all@freebsd.org Wed Apr 29 19:28:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2131C2C0218; Wed, 29 Apr 2020 19:28:57 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C7qF05F5z3D5m; Wed, 29 Apr 2020 19:28:57 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2817A864; Wed, 29 Apr 2020 19:28:56 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TJSuQu036373; Wed, 29 Apr 2020 19:28:56 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TJSua8036371; Wed, 29 Apr 2020 19:28:56 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004291928.03TJSua8036371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Wed, 29 Apr 2020 19:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360475 - in head/sys: net netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet6 X-SVN-Commit-Revision: 360475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 19:28:57 -0000 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) {