diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-03 09:50:27 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-03 09:50:27 +0000 |
commit | a9043049046af344a5f712e9c5884d60d0cb0e24 (patch) | |
tree | 9241ce69405bc8145f4988a1c28fc7a159cfad93 | |
parent | 984906fec80dbce0d1e00b2bfc8329e4fb787a35 (diff) |
Unconditionally set the RTF_UP flags when adding a route to the table.
This makes dhclient(8) configured default routes usable without relying
on the link-state change hooks not present in RAMDISK kernels.
ok krw@, claudio@
-rw-r--r-- | sys/net/route.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index b6b5e7e03d7..05a2cfe955f 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.228 2015/09/01 12:50:03 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.229 2015/09/03 09:50:26 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -900,21 +900,18 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio, return (ENOBUFS); } - rt->rt_flags = info->rti_flags; + rt->rt_flags = info->rti_flags | RTF_UP; rt->rt_tableid = tableid; rt->rt_priority = prio; /* init routing priority */ LIST_INIT(&rt->rt_timer); #ifndef SMALL_KERNEL - if (rtable_mpath_capable(tableid, ndst->sa_family)) { - /* check the link state since the table supports it */ - if (LINK_STATE_IS_UP(ifa->ifa_ifp->if_link_state) && - ifa->ifa_ifp->if_flags & IFF_UP) - rt->rt_flags |= RTF_UP; - else { - rt->rt_flags &= ~RTF_UP; - rt->rt_priority |= RTP_DOWN; - } + /* Check the link state if the table supports it. */ + if (rtable_mpath_capable(tableid, ndst->sa_family) && + (!LINK_STATE_IS_UP(ifa->ifa_ifp->if_link_state) || + !ISSET(ifa->ifa_ifp->if_flags, IFF_UP))) { + rt->rt_flags &= ~RTF_UP; + rt->rt_priority |= RTP_DOWN; } #endif |