From a9043049046af344a5f712e9c5884d60d0cb0e24 Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Thu, 3 Sep 2015 09:50:27 +0000 Subject: 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@ --- sys/net/route.c | 19 ++++++++----------- 1 file 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 -- cgit v1.2.3