diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-09-05 10:56:05 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-09-05 10:56:05 +0000 |
commit | 8eb5d17917397aa1ee106e16373b78b8b55fb6ea (patch) | |
tree | bfdd64d3a478558d9ef49ff2fc637e56ed96edb9 /sys/net/route.c | |
parent | a4b500858de38fe1d3fdc341bf4156fb89807203 (diff) |
Restart the iteration when a multipath list is re-ordered to make sure
no entry are missed.
While here do not re-ordered or send messages for route entries that are
already in the expected state.
Make rttest30 pass.
ok gerhard@
Diffstat (limited to 'sys/net/route.c')
-rw-r--r-- | sys/net/route.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 61914bab2e0..d766f14a9ce 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.366 2017/08/11 21:24:19 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.367 2017/09/05 10:56:04 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -1550,6 +1550,7 @@ rt_if_linkstate_change(struct rtentry *rt, void *arg, u_int id) { struct ifnet *ifp = arg; struct sockaddr_in6 sa_mask; + int error; if (rt->rt_ifidx != ifp->if_index) return (0); @@ -1561,38 +1562,37 @@ rt_if_linkstate_change(struct rtentry *rt, void *arg, u_int id) } if (LINK_STATE_IS_UP(ifp->if_link_state) && ifp->if_flags & IFF_UP) { - if (!(rt->rt_flags & RTF_UP)) { - /* bring route up */ - rt->rt_flags |= RTF_UP; - rtable_mpath_reprio(id, rt_key(rt), - rt_plen2mask(rt, &sa_mask), - rt->rt_priority & RTP_MASK, rt); - } - } else { - if (rt->rt_flags & RTF_UP) { - /* - * Remove redirected and cloned routes (mainly ARP) - * from down interfaces so we have a chance to get - * new routes from a better source. - */ - if (ISSET(rt->rt_flags, RTF_CLONED|RTF_DYNAMIC) && - !ISSET(rt->rt_flags, RTF_CACHED|RTF_BFD)) { - int error; + if (ISSET(rt->rt_flags, RTF_UP)) + return (0); - if ((error = rtdeletemsg(rt, ifp, id))) - return (error); - return (EAGAIN); - } - /* take route down */ - rt->rt_flags &= ~RTF_UP; - rtable_mpath_reprio(id, rt_key(rt), - rt_plen2mask(rt, &sa_mask), - rt->rt_priority | RTP_DOWN, rt); + /* bring route up */ + rt->rt_flags |= RTF_UP; + error = rtable_mpath_reprio(id, rt_key(rt), + rt_plen2mask(rt, &sa_mask), rt->rt_priority & RTP_MASK, rt); + } else { + /* + * Remove redirected and cloned routes (mainly ARP) + * from down interfaces so we have a chance to get + * new routes from a better source. + */ + if (ISSET(rt->rt_flags, RTF_CLONED|RTF_DYNAMIC) && + !ISSET(rt->rt_flags, RTF_CACHED|RTF_BFD)) { + if ((error = rtdeletemsg(rt, ifp, id))) + return (error); + return (EAGAIN); } + + if (!ISSET(rt->rt_flags, RTF_UP)) + return (0); + + /* take route down */ + rt->rt_flags &= ~RTF_UP; + error = rtable_mpath_reprio(id, rt_key(rt), + rt_plen2mask(rt, &sa_mask), rt->rt_priority | RTP_DOWN, rt); } if_group_routechange(rt_key(rt), rt_plen2mask(rt, &sa_mask)); - return (0); + return (error); } struct sockaddr * |