diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2019-04-02 10:46:03 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2019-04-02 10:46:03 +0000 |
commit | 70998fa777c8ccffebb4e06ce2f87940f9d26c97 (patch) | |
tree | a375be5bf7291794d253a77e483000cf0505994e /sys/net | |
parent | 16dc8a8183fef26d9c937eebae652e213904f920 (diff) |
some mbuf ph_rtableid fixes
consistently set the rtabled for "outgoing" packets to the encap
rdomain. use this for rtallocs in mpip too instead of assuming 0.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_mpe.c | 8 | ||||
-rw-r--r-- | sys/net/if_mpip.c | 10 | ||||
-rw-r--r-- | sys/net/if_mpw.c | 11 |
3 files changed, 21 insertions, 8 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c index e50d5a45930..bafe9d661bc 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpe.c,v 1.87 2019/03/18 03:21:20 dlg Exp $ */ +/* $OpenBSD: if_mpe.c,v 1.88 2019/04/02 10:46:02 dlg Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -196,6 +196,9 @@ mpe_start(struct ifnet *ifp) m->m_pkthdr.len += sizeof(struct shim_hdr); } #endif + + m->m_pkthdr.ph_rtableid = sc->sc_rdomain; + mpls_output(ifp0, m, &smpls, rt); if_put(ifp0); rtfree(rt); @@ -276,9 +279,6 @@ mpe_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, memcpy(mtod(m, struct sockaddr *), rt->rt_gateway, slen); mtod(m, struct sockaddr *)->sa_len = slen; /* to be sure */ - m->m_pkthdr.ph_ifidx = ifp->if_index; - /* XXX assumes MPLS is always in rdomain 0 */ - m->m_pkthdr.ph_rtableid = 0; m->m_pkthdr.ph_family = dst->sa_family; error = if_enqueue(ifp, m); diff --git a/sys/net/if_mpip.c b/sys/net/if_mpip.c index 5d19737c920..436610633bc 100644 --- a/sys/net/if_mpip.c +++ b/sys/net/if_mpip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpip.c,v 1.2 2019/03/18 03:20:36 dlg Exp $ */ +/* $OpenBSD: if_mpip.c,v 1.3 2019/04/02 10:46:02 dlg Exp $ */ /* * Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org> @@ -537,6 +537,10 @@ mpip_input(struct mpip_softc *sc, struct mbuf *m) m->m_pkthdr.ph_ifidx = ifp->if_index; m->m_pkthdr.ph_rtableid = ifp->if_rdomain; +#if NPF > 0 + pf_pkt_addr_changed(m); +#endif + #if NBPFILTER > 0 { caddr_t if_bpf = ifp->if_bpf; @@ -615,7 +619,7 @@ mpip_start(struct ifnet *ifp) return; } - rt = rtalloc(sstosa(&n->n_nexthop), RT_RESOLVE, 0); + rt = rtalloc(sstosa(&n->n_nexthop), RT_RESOLVE, sc->sc_rdomain); if (!rtisvalid(rt)) { IFQ_PURGE(&ifp->if_snd); goto rtfree; @@ -697,6 +701,8 @@ mpip_start(struct ifnet *ifp) shim |= bos; *mtod(m, uint32_t *) = shim; + m->m_pkthdr.ph_rtableid = sc->sc_rdomain; + mpls_output(ifp0, m, (struct sockaddr *)&smpls, rt); } diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c index 8e3825820f5..cd756a8f986 100644 --- a/sys/net/if_mpw.c +++ b/sys/net/if_mpw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpw.c,v 1.47 2019/03/18 03:20:36 dlg Exp $ */ +/* $OpenBSD: if_mpw.c,v 1.48 2019/04/02 10:46:02 dlg Exp $ */ /* * Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org> @@ -563,6 +563,13 @@ mpw_input(struct mpw_softc *sc, struct mbuf *m) m = n; } + m->m_pkthdr.ph_ifidx = ifp->if_index; + m->m_pkthdr.ph_rtableid = ifp->if_rdomain; + +#if NPF > 0 + pf_pkt_addr_changed(m); +#endif + ml_enqueue(&ml, m); if_input(ifp, &ml); return; @@ -671,7 +678,7 @@ mpw_start(struct ifnet *ifp) shim->shim_label = htonl(mpls_defttl) & MPLS_TTL_MASK; shim->shim_label |= n->n_rshim.shim_label | bos; - m0->m_pkthdr.ph_rtableid = ifp->if_rdomain; + m0->m_pkthdr.ph_rtableid = sc->sc_rdomain; mpls_output(ifp0, m0, (struct sockaddr *)&smpls, rt); } |