The branch stable/13 has been updated by melifaro:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=88452cb1515550b5a9eb78ed2d88c97d09a57ee4

commit 88452cb1515550b5a9eb78ed2d88c97d09a57ee4
Author:     Alexander V. Chernikov <melif...@freebsd.org>
AuthorDate: 2021-01-29 23:10:52 +0000
Commit:     Alexander V. Chernikov <melif...@freebsd.org>
CommitDate: 2021-02-04 22:33:20 +0000

    MFC cb984c62d705: Fix multipath support for rib_lookup_info().
    
    The initial plan was to remove rib_lookup_info() before
     FreeBSD 13. As several customers are still remaining,
     fix rib_lookup_info() for the multipath use case.
---
 sys/net/route.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/sys/net/route.c b/sys/net/route.c
index 7e087569d45f..a68e46c37861 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -79,8 +79,8 @@ EVENTHANDLER_LIST_DEFINE(rt_addrmsg);
 
 static int rt_ifdelroute(const struct rtentry *rt, const struct nhop_object *,
     void *arg);
-static int rt_exportinfo(struct rtentry *rt, struct rt_addrinfo *info,
-    int flags);
+static int rt_exportinfo(struct rtentry *rt, struct nhop_object *nh,
+    struct rt_addrinfo *info, int flags);
 
 /*
  * route initialization must occur before ip6_init2(), which happenas at
@@ -330,15 +330,14 @@ ifa_ifwithroute(int flags, const struct sockaddr *dst,
  *
  * Returns 0 on success.
  */
-int
-rt_exportinfo(struct rtentry *rt, struct rt_addrinfo *info, int flags)
+static int
+rt_exportinfo(struct rtentry *rt, struct nhop_object *nh,
+    struct rt_addrinfo *info, int flags)
 {
        struct rt_metrics *rmx;
        struct sockaddr *src, *dst;
-       struct nhop_object *nh;
        int sa_len;
 
-       nh = rt->rt_nhop;
        if (flags & NHR_COPY) {
                /* Copy destination if dst is non-zero */
                src = rt_key(rt);
@@ -424,6 +423,7 @@ rib_lookup_info(uint32_t fibnum, const struct sockaddr 
*dst, uint32_t flags,
        struct rib_head *rh;
        struct radix_node *rn;
        struct rtentry *rt;
+       struct nhop_object *nh;
        int error;
 
        KASSERT((fibnum < rt_numfibs), ("rib_lookup_rte: bad fibnum"));
@@ -435,10 +435,11 @@ rib_lookup_info(uint32_t fibnum, const struct sockaddr 
*dst, uint32_t flags,
        rn = rh->rnh_matchaddr(__DECONST(void *, dst), &rh->head);
        if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) {
                rt = RNTORT(rn);
+               nh = nhop_select(rt->rt_nhop, flowid);
                /* Ensure route & ifp is UP */
-               if (RT_LINK_IS_UP(rt->rt_nhop->nh_ifp)) {
+               if (RT_LINK_IS_UP(nh->nh_ifp)) {
                        flags = (flags & NHR_REF) | NHR_COPY;
-                       error = rt_exportinfo(rt, info, flags);
+                       error = rt_exportinfo(rt, nh, info, flags);
                        RIB_RUNLOCK(rh);
 
                        return (error);
_______________________________________________
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"

Reply via email to