summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-09-03 09:50:26 +0000
committermpi <mpi@openbsd.org>2015-09-03 09:50:26 +0000
commitf045bdde2045db2d17cffa52fbc8f1e8dc309eb3 (patch)
treee04de36d2f1126bf64d1d31e68c17c19ebbf785f /sys
parentImprove the code that tries to figure out which device we booted from. The (diff)
downloadwireguard-openbsd-f045bdde2045db2d17cffa52fbc8f1e8dc309eb3.tar.xz
wireguard-openbsd-f045bdde2045db2d17cffa52fbc8f1e8dc309eb3.zip
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')
-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