summaryrefslogtreecommitdiff
path: root/sys/netmpls
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2008-05-08 03:18:40 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2008-05-08 03:18:40 +0000
commit1520857aab010c5a43c35e35b2225dc10e9b2fb4 (patch)
tree6e739848105a08e4d73b2c711088661dd0246e99 /sys/netmpls
parent3dda6abee0e02dce0e2dbc4df96235f495557e0a (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/netmpls')
-rw-r--r--sys/netmpls/mpls.h5
-rw-r--r--sys/netmpls/mpls_input.c22
2 files changed, 16 insertions, 11 deletions
diff --git a/sys/netmpls/mpls.h b/sys/netmpls/mpls.h
index 45185c8bc46..fed04276ba1 100644
--- a/sys/netmpls/mpls.h
+++ b/sys/netmpls/mpls.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls.h,v 1.8 2008/05/07 08:00:50 pyr Exp $ */
+/* $OpenBSD: mpls.h,v 1.9 2008/05/08 03:18:39 claudio Exp $ */
/*
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
@@ -152,7 +152,8 @@ struct mpe_softc {
#define MPE_MTU_MIN 256
#define MPE_MTU_MAX 8192
-void mpe_input(struct mbuf *);
+void mpe_input(struct mbuf *, struct ifnet *, struct sockaddr_mpls *,
+ u_int32_t);
extern int mpls_raw_usrreq(struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *);
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index 9081b2f6339..7bf6519e669 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.10 2008/05/06 13:33:50 pyr Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.11 2008/05/08 03:18:39 claudio Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -22,6 +22,7 @@
#include <sys/socket.h>
#include <net/if.h>
+#include <net/if_types.h>
#include <net/route.h>
#include <netmpls/mpls.h>
@@ -71,7 +72,7 @@ mpls_input(struct mbuf *m)
struct shim_hdr *shim;
struct rtentry *rt = NULL;
u_int32_t ttl;
- int i;
+ int i, hasbos;
if (!mpls_enable) {
m_freem(m);
@@ -111,13 +112,6 @@ mpls_input(struct mbuf *m)
ttl = htonl(ttl - 1);
for (i = 0; i < mpls_inkloop; i++) {
- /* XXX maybe this should be done later */
- if (MPLS_BOS_ISSET(shim->shim_label)) {
- /* no LER until now */
- m_freem(m);
- goto done;
- }
-
bzero(&sa_mpls, sizeof(sa_mpls));
smpls = &sa_mpls;
smpls->smpls_family = AF_MPLS;
@@ -156,7 +150,17 @@ mpls_input(struct mbuf *m)
switch (smpls->smpls_operation) {
case MPLS_OP_POP:
+ hasbos = MPLS_BOS_ISSET(shim->shim_label);
m = mpls_shim_pop(m);
+ if (hasbos) {
+ if (rt->rt_ifp->if_type == IFT_MPLS) {
+ mpe_input(m, rt->rt_ifp, smpls, ttl);
+ goto done;
+ }
+ /* last label but we have no clue so drop */
+ m_freem(m);
+ goto done;
+ }
break;
case MPLS_OP_PUSH:
m = mpls_shim_push(m, smpls);