diff options
| author | 2010-05-28 12:09:09 +0000 | |
|---|---|---|
| committer | 2010-05-28 12:09:09 +0000 | |
| commit | 769a1fea285f19c0a9cb41f1b4606a8c59697993 (patch) | |
| tree | e2f32986198aeb7045f73aa001b35f6fd14e5807 /sys/net/if_ethersubr.c | |
| parent | Add missing initialization. (diff) | |
| download | wireguard-openbsd-769a1fea285f19c0a9cb41f1b4606a8c59697993.tar.xz wireguard-openbsd-769a1fea285f19c0a9cb41f1b4606a8c59697993.zip | |
Rework the way we handle MPLS in the kernel. Instead of fumbling MPLS into
ether_output() and later on other L2 output functions use a trick and over-
load the ifp->if_output() function pointer on MPLS enabled interfaces to
go through mpls_output() which will then call the link level output function.
By setting IFXF_MPLS on an interface the output pointers are switched.
This now allows to cleanup the MPLS input and output pathes and fix mpe(4)
so that the MPLS code now actually works for both P and PE systems.
Tested by myself and michele
(A custom kernel with MPLS and mpe enabled is still needed).
Diffstat (limited to 'sys/net/if_ethersubr.c')
| -rw-r--r-- | sys/net/if_ethersubr.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 0e2ab27b3d3..0c40eccc614 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.142 2010/05/07 13:33:16 claudio Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.143 2010/05/28 12:09:09 claudio Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -277,12 +277,7 @@ ether_output(ifp0, m0, dst, rt0) else senderr(EHOSTUNREACH); } -#ifdef MPLS - if (rt->rt_flags & RTF_MPLS) { - if ((m = mpls_output(m, rt)) == NULL) - senderr(EHOSTUNREACH); - } -#endif + if (rt->rt_flags & RTF_GATEWAY) { if (rt->rt_gwroute == 0) goto lookup; @@ -299,7 +294,6 @@ ether_output(ifp0, m0, dst, rt0) time_second < rt->rt_rmx.rmx_expire) senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); } - switch (dst->sa_family) { #ifdef INET @@ -310,12 +304,7 @@ ether_output(ifp0, m0, dst, rt0) if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX) && !m->m_pkthdr.pf.routed) mcopy = m_copy(m, 0, (int)M_COPYALL); -#ifdef MPLS - if (rt0 != NULL && rt0->rt_flags & RTF_MPLS) - etype = htons(ETHERTYPE_MPLS); - else -#endif - etype = htons(ETHERTYPE_IP); + etype = htons(ETHERTYPE_IP); break; #endif #ifdef INET6 @@ -382,6 +371,9 @@ ether_output(ifp0, m0, dst, rt0) else senderr(EHOSTUNREACH); + if (!ISSET(ifp->if_xflags, IFXF_MPLS)) + senderr(ENETUNREACH); + switch (dst->sa_family) { case AF_LINK: if (((struct sockaddr_dl *)dst)->sdl_alen < @@ -490,7 +482,6 @@ ether_output(ifp0, m0, dst, rt0) } } #endif - mflags = m->m_flags; len = m->m_pkthdr.len; s = splnet(); |
