diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-02-09 16:31:15 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-02-09 16:31:15 +0000 |
commit | 7e81f6b4ab8d0ee488afcd022730b1bf49ef7b75 (patch) | |
tree | 00cc06bbe34890577f088dea7ab7e4db5d86a290 /sys | |
parent | 43b4c81c86e26b76534d4c78da506f0f2db80ffb (diff) |
Correctly track RTF_UP on RTM_CHANGE. Since the interface can change
rt_if_linkstate_change() needs to be rerun for this route and the
resulting rt_flags need to copied to the rtm_flags for userland.
Problem found and diagnosed by Doran Mori. OK henning@, jsing@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/route.c | 5 | ||||
-rw-r--r-- | sys/net/route.h | 3 | ||||
-rw-r--r-- | sys/net/rtsock.c | 8 |
3 files changed, 10 insertions, 6 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 9a798e2fbf3..9bea0705605 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.114 2009/11/03 10:59:04 claudio Exp $ */ +/* $OpenBSD: route.c,v 1.115 2010/02/09 16:31:14 claudio Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -152,9 +152,6 @@ int okaytoclone(u_int, int); int rtflushclone1(struct radix_node *, void *); void rtflushclone(struct radix_node_head *, struct rtentry *); int rt_if_remove_rtdelete(struct radix_node *, void *); -#ifndef SMALL_KERNEL -int rt_if_linkstate_change(struct radix_node *, void *); -#endif #define LABELID_MAX 50000 diff --git a/sys/net/route.h b/sys/net/route.h index 954331a2b21..ca4940d16e7 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.65 2009/11/03 10:59:04 claudio Exp $ */ +/* $OpenBSD: route.h,v 1.66 2010/02/09 16:31:14 claudio Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -394,6 +394,7 @@ int rtrequest1(int, struct rt_addrinfo *, u_int8_t, struct rtentry **, void rt_if_remove(struct ifnet *); #ifndef SMALL_KERNEL void rt_if_track(struct ifnet *); +int rt_if_linkstate_change(struct radix_node *, void *); #endif int rtdeletemsg(struct rtentry *, u_int); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index d162048c049..fae0a622d6b 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.95 2009/11/03 10:59:04 claudio Exp $ */ +/* $OpenBSD: rtsock.c,v 1.96 2010/02/09 16:31:14 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -638,6 +638,11 @@ report: rt->rt_ifa = ifa; ifa->ifa_refcnt++; rt->rt_ifp = ifp; +#ifndef SMALL_KERNEL + /* recheck link state after ifp change */ + rt_if_linkstate_change( + (struct radix_node *)rt, ifp); +#endif } } @@ -651,6 +656,7 @@ report: &rt->rt_rmx); rtm->rtm_index = rt->rt_ifp->if_index; rtm->rtm_priority = rt->rt_priority & RTP_MASK; + rtm->rtm_flags = rt->rt_flags; if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest) rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, &info); if (genmask) |