diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-05-08 03:18:40 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-05-08 03:18:40 +0000 |
commit | 1520857aab010c5a43c35e35b2225dc10e9b2fb4 (patch) | |
tree | 6e739848105a08e4d73b2c711088661dd0246e99 /sys/net/if_mpe.c | |
parent | 3dda6abee0e02dce0e2dbc4df96235f495557e0a (diff) |
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@
Diffstat (limited to 'sys/net/if_mpe.c')
-rw-r--r-- | sys/net/if_mpe.c | 30 |
1 files changed, 13 insertions, 17 deletions
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(); /* |