summaryrefslogtreecommitdiff
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-09-25 09:51:21 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-09-25 09:51:21 +0000
commit0df99b969a1c93a9608031012e0d999dc2c29416 (patch)
tree27b224d37ee3130db50225245519b280f86302ac /sys/net/route.c
parent83e4067068dcfedbf87724c8da3da3191f29c3f9 (diff)
Ensure that RTF_LOCAL route entries always stay UP.
Local route entries, being now attached to their corresponding interface, are susceptible to be brought DOWN when a link state change occurs. When this happens locally configured addresses are no longer reachable. So keep the previous (original) behavior by forcing such route entries to always be UP. ok sthen@, claudio@
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index f210a240920..ea879e4527f 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.242 2015/09/23 08:49:46 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.243 2015/09/25 09:51:20 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1743,6 +1743,12 @@ rt_if_linkstate_change(struct rtentry *rt, void *arg, u_int id)
(rt->rt_ifa == NULL || rt->rt_ifa->ifa_ifp != ifp))
return (0);
+ /* Local routes are always usable. */
+ if (rt->rt_flags & RTF_LOCAL) {
+ rt->rt_flags |= RTF_UP;
+ return (0);
+ }
+
if (LINK_STATE_IS_UP(ifp->if_link_state) && ifp->if_flags & IFF_UP) {
if (!(rt->rt_flags & RTF_UP)) {
/* bring route up */