summaryrefslogtreecommitdiff
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-09-03 09:50:27 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-09-03 09:50:27 +0000
commita9043049046af344a5f712e9c5884d60d0cb0e24 (patch)
tree9241ce69405bc8145f4988a1c28fc7a159cfad93 /sys/net/route.c
parent984906fec80dbce0d1e00b2bfc8329e4fb787a35 (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@
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c19
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