From 1520857aab010c5a43c35e35b2225dc10e9b2fb4 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Thu, 8 May 2008 03:18:40 +0000 Subject: Hook mpe(4) correctly into mpls so that it is possible to tunnel packets over MPLS. Still a bit hackish but getting closer. hai norby@ --- sys/net/if_mpe.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'sys/net/if_mpe.c') diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c index 348e9ed0d99..29c0370cefe 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -152,6 +152,15 @@ mpeoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, int error; error = 0; + /* + * drop MPLS packets entering here. This is a hack to prevent + * loops because of misconfiguration. + */ + if (dst->sa_family == AF_MPLS) { + m_freem(m); + error = ENETUNREACH; + return (error); + } s = splnet(); IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error); if (error) { @@ -232,26 +241,13 @@ mpeioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } void -mpe_input(struct mbuf *m) +mpe_input(struct mbuf *m, struct ifnet *ifp, struct sockaddr_mpls *smpls, + u_int32_t ttl) { int s; - struct shim_hdr *shim; - shim = mtod(m, struct shim_hdr *); - if (!(MPLS_BOS_ISSET(shim->shim_label))) { -#ifdef MPLS_DEBUG - printf("mpe_input: invalid packet with non BoS label\n"); -#endif - m_free(m); - return; - } - - -#ifdef MPLS_DEBUG - printf("mpe_input: got packet with label: %d\n", - ((ntohl(shim->shim_label & MPLS_LABEL_MASK)) >> MPLS_LABEL_OFFSET)); -#endif - m_adj(m, sizeof(shim)); + /* fixup ttl */ + /* label -> AF lookup */ s = splnet(); /* -- cgit v1.2.3