diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-25 09:51:21 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-25 09:51:21 +0000 |
commit | 0df99b969a1c93a9608031012e0d999dc2c29416 (patch) | |
tree | 27b224d37ee3130db50225245519b280f86302ac /sys | |
parent | 83e4067068dcfedbf87724c8da3da3191f29c3f9 (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')
-rw-r--r-- | sys/net/route.c | 8 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 4 |
2 files changed, 9 insertions, 3 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 */ diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 35c915b4789..b630e798a3d 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.255 2015/09/11 19:34:20 dlg Exp $ */ +/* $OpenBSD: ip_input.c,v 1.256 2015/09/25 09:51:20 mpi Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -725,7 +725,7 @@ in_ouraddr(struct mbuf *m, struct ifnet *ifp, struct in_addr ina) m->m_flags |= M_BCAST; } - return (ISSET(ia->ia_ifp->if_flags, IFF_UP)); + return (1); } /* |