diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-07-13 16:23:29 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-07-13 16:23:29 +0000 |
commit | 05c6d0668eda3213f427d840f5f588636d06a4d2 (patch) | |
tree | d29d241d6c226e8d34c7d313b9cb2437894b2fb5 /sys | |
parent | f004d648bde7d24b7691c12e2229db4875fb8cb8 (diff) |
Do the same rdomain checking in sppp as we do in the Ethernet case.
Encapsulated pppoe packets are moved into the rdomain of the physical interface
because it is possible that a pppoe(4) interface is in a different rdomain
then the physical interface.
OK reyk@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_pppoe.c | 5 | ||||
-rw-r--r-- | sys/net/if_spppsubr.c | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c index 7bbfd31e0de..e035ea87529 100644 --- a/sys/net/if_pppoe.c +++ b/sys/net/if_pppoe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppoe.c,v 1.30 2009/03/15 19:40:41 miod Exp $ */ +/* $OpenBSD: if_pppoe.c,v 1.31 2009/07/13 16:23:28 claudio Exp $ */ /* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */ /* @@ -877,6 +877,9 @@ pppoe_output(struct pppoe_softc *sc, struct mbuf *m) ether_sprintf((unsigned char *)&sc->sc_dest), m->m_pkthdr.len)); m->m_flags &= ~(M_BCAST|M_MCAST); + /* encapsulated packet is forced into rdomain of physical interface */ + m->m_pkthdr.rdomain = sc->sc_eth_if->if_rdomain; + sc->sc_sppp.pp_if.if_opackets++; return (sc->sc_eth_if->if_output(sc->sc_eth_if, m, &dst, NULL)); } diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 44784cd09d5..7f483d74b3f 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.75 2009/02/18 08:36:20 canacar Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.76 2009/07/13 16:23:28 claudio Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. * Keepalive protocol implemented in both Cisco and PPP modes. @@ -521,6 +521,9 @@ sppp_input(struct ifnet *ifp, struct mbuf *m) return; } + /* mark incomming routing domain */ + m->m_pkthdr.rdomain = ifp->if_rdomain; + if (sp->pp_flags & PP_NOFRAMING) { memcpy(&ht.protocol, mtod(m, char *), sizeof(ht.protocol)); m_adj(m, 2); @@ -695,6 +698,16 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, int s, len, rv = 0; u_int16_t protocol; +#ifdef DIAGNOSTIC + if (ifp->if_rdomain != m->m_pkthdr.rdomain) { + printf("%s: trying to send packet on wrong domain. " + "%d vs. %d, AF %d\n", ifp->if_xname, ifp->if_rdomain, + m->m_pkthdr.rdomain, dst->sa_family); + m_freem (m); + return (ENETDOWN); + } +#endif + s = splnet(); getmicrouptime(&tv); |