diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-03-26 21:56:05 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-03-26 21:56:05 +0000 |
commit | a97a3837acdb017ab0dd069b3a34f1c9042d1315 (patch) | |
tree | 6f644a3fca55671bae40f48cfc675514c40c5f76 /sys/net | |
parent | e3346862b0a21aa0b288a7639ea4909b0ea2b766 (diff) |
Always include the route priority in routing messages.
From Florian Riehm, ok bluhm@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/route.c | 20 | ||||
-rw-r--r-- | sys/net/route.h | 4 | ||||
-rw-r--r-- | sys/net/rtsock.c | 7 |
3 files changed, 19 insertions, 12 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 4c9f9bc6dfe..b87ec412a2b 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.297 2016/03/26 21:41:18 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.298 2016/03/26 21:56:04 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -248,8 +248,8 @@ rt_match(struct sockaddr *dst, uint32_t *src, int flags, unsigned int tableid) error = rtrequest(RTM_RESOLVE, &info, RTP_DEFAULT, &rt, tableid); if (error) { - rt_missmsg(RTM_MISS, &info, 0, 0, error, - tableid); + rt_missmsg(RTM_MISS, &info, 0, RTP_NONE, 0, + error, tableid); } else { /* Inform listeners of the new route */ rt_sendmsg(rt, RTM_ADD, tableid); @@ -489,7 +489,8 @@ rt_sendmsg(struct rtentry *rt, int cmd, u_int rtableid) info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; } - rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_ifidx, 0, rtableid); + rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_priority, rt->rt_ifidx, 0, + rtableid); if_put(ifp); } @@ -523,6 +524,7 @@ rtredirect(struct sockaddr *dst, struct sockaddr *gateway, struct ifaddr *ifa; unsigned int ifidx = 0; int flags = RTF_GATEWAY|RTF_HOST; + uint8_t prio = RTP_NONE; splsoftassert(IPL_SOFTNET); @@ -579,8 +581,10 @@ create: rt = NULL; error = rtrequest(RTM_ADD, &info, RTP_DEFAULT, &rt, rdomain); - if (error == 0) + if (error == 0) { flags = rt->rt_flags; + prio = rt->rt_priority; + } stat = &rtstat.rts_dynamic; } else { /* @@ -589,6 +593,7 @@ create: */ rt->rt_flags |= RTF_MODIFIED; flags |= RTF_MODIFIED; + prio = rt->rt_priority; stat = &rtstat.rts_newgateway; rt_setgate(rt, gateway); } @@ -610,7 +615,7 @@ out: info.rti_info[RTAX_DST] = dst; info.rti_info[RTAX_GATEWAY] = gateway; info.rti_info[RTAX_AUTHOR] = src; - rt_missmsg(RTM_REDIRECT, &info, flags, ifidx, error, rdomain); + rt_missmsg(RTM_REDIRECT, &info, flags, prio, ifidx, error, rdomain); } /* @@ -639,7 +644,8 @@ rtdeletemsg(struct rtentry *rt, struct ifnet *ifp, u_int tableid) info.rti_flags = rt->rt_flags; ifidx = rt->rt_ifidx; error = rtrequest_delete(&info, rt->rt_priority, ifp, &rt, tableid); - rt_missmsg(RTM_DELETE, &info, info.rti_flags, ifidx, error, tableid); + rt_missmsg(RTM_DELETE, &info, info.rti_flags, rt->rt_priority, ifidx, + error, tableid); if (error == 0) rtfree(rt); return (error); diff --git a/sys/net/route.h b/sys/net/route.h index 7741cdfd07c..15b76bfed3d 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.132 2016/02/24 22:41:53 mpi Exp $ */ +/* $OpenBSD: route.h,v 1.133 2016/03/26 21:56:04 mpi Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -360,7 +360,7 @@ void rt_maskedcopy(struct sockaddr *, struct sockaddr *rt_plen2mask(struct rtentry *, struct sockaddr_in6 *); void rt_sendmsg(struct rtentry *, int, u_int); void rt_sendaddrmsg(struct rtentry *, int); -void rt_missmsg(int, struct rt_addrinfo *, int, u_int, int, u_int); +void rt_missmsg(int, struct rt_addrinfo *, int, uint8_t, u_int, int, u_int); int rt_setgate(struct rtentry *, struct sockaddr *); int rt_checkgate(struct ifnet *, struct rtentry *, struct sockaddr *, unsigned int, struct rtentry **); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index d60efee3f31..008d91e0a77 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.186 2016/01/12 09:27:46 mpi Exp $ */ +/* $OpenBSD: rtsock.c,v 1.187 2016/03/26 21:56:04 mpi Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -1063,8 +1063,8 @@ again: * destination. */ void -rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, u_int ifidx, - int error, u_int tableid) +rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, uint8_t prio, + u_int ifidx, int error, u_int tableid) { struct rt_msghdr *rtm; struct mbuf *m; @@ -1077,6 +1077,7 @@ rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, u_int ifidx, return; rtm = mtod(m, struct rt_msghdr *); rtm->rtm_flags = RTF_DONE | flags; + rtm->rtm_priority = prio; rtm->rtm_errno = error; rtm->rtm_tableid = tableid; rtm->rtm_addrs = rtinfo->rti_addrs; |