diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2021-01-29 23:10:52 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2021-01-29 23:14:24 +0000 |
commit | cb984c62d705e4229998fdb076d012666a2196da (patch) | |
tree | 683f0ead4ed9a16abd40fe391b4215de03f1816b /sys/net | |
parent | 53729367d388e4a6d0ff9be9995bcd4957e9c114 (diff) | |
download | src-cb984c62d705e4229998fdb076d012666a2196da.tar.gz src-cb984c62d705e4229998fdb076d012666a2196da.zip |
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.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/route.c | 17 |
1 files 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); |