diff options
author | Michele Marchetto <michele@cvs.openbsd.org> | 2009-02-03 16:42:55 +0000 |
---|---|---|
committer | Michele Marchetto <michele@cvs.openbsd.org> | 2009-02-03 16:42:55 +0000 |
commit | 628b50697a8761bcac8e34d9ffdff103646d2ee5 (patch) | |
tree | c54d8e7ccca81946fdf4770fd31ea7a5e3e6bfac /sys/net | |
parent | 444bd5f6a3e4b86e7149f6cf0a472cd13248ac01 (diff) |
Use our own flags to set the operations and not RTF_PROTOX.
Switch the padding field into a MPLS one in rt_msghdr to store
relevant informations.
OK claudio@ laurent@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/route.c | 5 | ||||
-rw-r--r-- | sys/net/route.h | 5 | ||||
-rw-r--r-- | sys/net/rtsock.c | 24 |
3 files changed, 16 insertions, 18 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 3e5ec851890..cc8931836c1 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.102 2009/01/28 22:18:44 michele Exp $ */ +/* $OpenBSD: route.c,v 1.103 2009/02/03 16:42:54 michele Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -897,8 +897,7 @@ makeroute: if (sa_mpls != NULL) rt_mpls->mpls_label = sa_mpls->smpls_label; - rt_mpls->mpls_operation = rt->rt_flags & - (MPLS_OP_PUSH | MPLS_OP_POP | MPLS_OP_SWAP); + rt_mpls->mpls_operation = info->rti_mpls; /* XXX: set experimental bits */ diff --git a/sys/net/route.h b/sys/net/route.h index bce1dfd2534..5fc0d2fb751 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.58 2009/01/28 22:18:44 michele Exp $ */ +/* $OpenBSD: route.h,v 1.59 2009/02/03 16:42:54 michele Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -193,7 +193,7 @@ struct rt_msghdr { u_short rtm_index; /* index for associated ifp */ u_short rtm_tableid; /* routing table id */ u_char rtm_priority; /* routing priority */ - u_char rtm_pad; + u_char rtm_mpls; /* MPLS additional infos */ int rtm_addrs; /* bitmask identifying sockaddrs in msg */ int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ int rtm_fmask; /* bitmask used in RTM_CHANGE message */ @@ -310,6 +310,7 @@ struct rt_addrinfo { struct ifaddr *rti_ifa; struct ifnet *rti_ifp; struct rt_msghdr *rti_rtm; + u_char rti_mpls; }; struct route_cb { diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index f86ad767a6e..5999cbb1774 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.83 2009/01/28 22:18:44 michele Exp $ */ +/* $OpenBSD: rtsock.c,v 1.84 2009/02/03 16:42:54 michele Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -438,6 +438,9 @@ route_output(struct mbuf *m, ...) goto flush; } } +#ifdef MPLS + info.rti_mpls = rtm->rtm_mpls; +#endif /* * Verify that the caller has the appropriate privilege; RTM_GET @@ -572,6 +575,8 @@ report: rt->rt_llinfo)->mpls_label; info.rti_info[RTAX_SRC] = (struct sockaddr *)&sa_mpls; + info.rti_mpls = ((struct rt_mpls *) + rt->rt_llinfo)->mpls_operation; } #endif ifpaddr = 0; @@ -1113,6 +1118,8 @@ sysctl_dumpentry(struct radix_node *rn, void *v) sa_mpls.smpls_label = ((struct rt_mpls *) rt->rt_llinfo)->mpls_label; info.rti_info[RTAX_SRC] = (struct sockaddr *)&sa_mpls; + info.rti_mpls = ((struct rt_mpls *) + rt->rt_llinfo)->mpls_operation; } #endif @@ -1121,17 +1128,14 @@ sysctl_dumpentry(struct radix_node *rn, void *v) struct rt_msghdr *rtm = (struct rt_msghdr *)w->w_tmem; rtm->rtm_flags = rt->rt_flags; -#ifdef MPLS - if (dst->sa_family == AF_MPLS) { - rtm->rtm_flags |= - ((struct rt_mpls *)rt->rt_llinfo)->mpls_operation; - } -#endif rtm->rtm_priority = rt->rt_priority; rt_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx); rtm->rtm_rmx.rmx_refcnt = rt->rt_refcnt; rtm->rtm_index = rt->rt_ifp->if_index; rtm->rtm_addrs = info.rti_addrs; +#ifdef MPLS + rtm->rtm_mpls = info.rti_mpls; +#endif if ((error = copyout(rtm, w->w_where, size)) != 0) w->w_where = NULL; else @@ -1143,12 +1147,6 @@ sysctl_dumpentry(struct radix_node *rn, void *v) struct rt_omsghdr *rtm = (struct rt_omsghdr *)w->w_tmem; rtm->rtm_flags = rt->rt_flags; -#ifdef MPLS - if (dst->sa_family == AF_MPLS) { - rtm->rtm_flags |= - ((struct rt_mpls *)rt->rt_llinfo)->mpls_operation; - } -#endif rtm->rtm_rmx.rmx_locks = rt->rt_rmx.rmx_locks; rtm->rtm_rmx.rmx_mtu = rt->rt_rmx.rmx_mtu; rtm->rtm_index = rt->rt_ifp->if_index; |