diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-04-22 19:43:08 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-04-22 19:43:08 +0000 |
commit | e957be00cb46172aa97ac11e3225eef711e61ea5 (patch) | |
tree | 725016839ae1c260b310ff8f8548b9a0b19b188a | |
parent | 554254748ba070f7afb59034cc4a0eef2ac9879d (diff) |
Routes announced via rt_missmsg() do not have rtm_index set. While in most
cases harmless it is used by the IPv6 code. The result is that bgpd is unable
to assigning link local addresses to the correct interface. OK henning@
Fix for PR 5063.
-rw-r--r-- | sys/net/route.c | 14 | ||||
-rw-r--r-- | sys/net/route.h | 4 | ||||
-rw-r--r-- | sys/net/rtsock.c | 7 | ||||
-rw-r--r-- | sys/netinet/in_pcb.c | 4 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 4 |
5 files changed, 19 insertions, 14 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index b785a803e4e..59ec31519d9 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.70 2006/03/22 14:37:44 henning Exp $ */ +/* $OpenBSD: route.c,v 1.71 2006/04/22 19:43:06 claudio Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -236,7 +236,7 @@ miss: if (report) { bzero((caddr_t)&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; - rt_missmsg(msgtype, &info, 0, err); + rt_missmsg(msgtype, &info, 0, NULL, err); } } splx(s); @@ -289,7 +289,7 @@ rtalloc1(struct sockaddr *dst, int report) TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr; info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; } - rt_missmsg(RTM_ADD, &info, rt->rt_flags, 0); + rt_missmsg(RTM_ADD, &info, rt->rt_flags, rt->rt_ifp, 0); } else rt->rt_refcnt++; } else { @@ -304,7 +304,7 @@ miss: if (report && dst->sa_family != PF_KEY) { bzero((caddr_t)&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; - rt_missmsg(msgtype, &info, 0, err); + rt_missmsg(msgtype, &info, 0, NULL, err); } } splx(s); @@ -455,7 +455,7 @@ out: info.rti_info[RTAX_GATEWAY] = gateway; info.rti_info[RTAX_NETMASK] = netmask; info.rti_info[RTAX_AUTHOR] = src; - rt_missmsg(RTM_REDIRECT, &info, flags, error); + rt_missmsg(RTM_REDIRECT, &info, flags, ifa->ifa_ifp, error); } /* @@ -466,6 +466,7 @@ rtdeletemsg(struct rtentry *rt) { int error; struct rt_addrinfo info; + struct ifnet *ifp; /* * Request the new route so that the entry is not actually @@ -477,9 +478,10 @@ rtdeletemsg(struct rtentry *rt) info.rti_info[RTAX_NETMASK] = rt_mask(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; info.rti_flags = rt->rt_flags; + ifp = rt->rt_ifp; error = rtrequest1(RTM_DELETE, &info, &rt); - rt_missmsg(RTM_DELETE, &info, info.rti_flags, error); + rt_missmsg(RTM_DELETE, &info, info.rti_flags, ifp, error); /* Adjust the refcount */ if (error == 0 && rt->rt_refcnt <= 0) { diff --git a/sys/net/route.h b/sys/net/route.h index 03bb38f06d4..372d8b1fc99 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.38 2006/03/30 09:53:43 claudio Exp $ */ +/* $OpenBSD: route.h,v 1.39 2006/04/22 19:43:07 claudio Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -317,7 +317,7 @@ void rt_ifmsg(struct ifnet *); void rt_ifannouncemsg(struct ifnet *, int); void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); -void rt_missmsg(int, struct rt_addrinfo *, int, int); +void rt_missmsg(int, struct rt_addrinfo *, int, struct ifnet *, int); void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *); int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 05d1ac7b2ee..0d181be85b8 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.57 2006/03/31 17:30:39 claudio Exp $ */ +/* $OpenBSD: rtsock.c,v 1.58 2006/04/22 19:43:07 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -639,7 +639,8 @@ again: * destination. */ void -rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) +rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, struct ifnet *ifp, + int error) { struct rt_msghdr *rtm; struct mbuf *m; @@ -654,6 +655,8 @@ rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) rtm->rtm_flags = RTF_DONE | flags; rtm->rtm_errno = error; rtm->rtm_addrs = rtinfo->rti_addrs; + if (ifp != NULL) + rtm->rtm_index = ifp->if_index; if (sa == NULL) route_proto.sp_protocol = 0; else diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 1dc2af9749e..842e2c6f192 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.85 2006/03/05 21:48:56 miod Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.86 2006/04/22 19:43:07 claudio Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -630,7 +630,7 @@ in_losing(inp) info.rti_info[RTAX_DST] = &inp->inp_route.ro_dst; info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; info.rti_info[RTAX_NETMASK] = rt_mask(rt); - rt_missmsg(RTM_LOSING, &info, rt->rt_flags, 0); + rt_missmsg(RTM_LOSING, &info, rt->rt_flags, rt->rt_ifp, 0); if (rt->rt_flags & RTF_DYNAMIC) (void) rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt), rt->rt_flags, diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 04553d07d5e..e0322c637c1 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.37 2006/03/22 14:37:45 henning Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.38 2006/04/22 19:43:07 claudio Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -431,7 +431,7 @@ nd6_rtmsg(cmd, rt) info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; } - rt_missmsg(cmd, &info, rt->rt_flags, 0); + rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_ifp, 0); } void |