summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2008-05-07 08:00:51 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2008-05-07 08:00:51 +0000
commitc04383ba5f6c4cd2410903d3fc5c491c6c5a7d44 (patch)
tree4d9932c46c92fc337c0e6383b97bea5c402a5ff1
parent3479ed2e5aaf9b953d19dcb44bb4360ddde9e1ff (diff)
add mpe_input() to be able to be fed packets that will reenter ip.
no consumers yet, they should come soon. ok norby@
-rw-r--r--sys/net/if_mpe.c32
-rw-r--r--sys/netmpls/mpls.h4
2 files changed, 35 insertions, 1 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index 28c05d5621f..e388d67e2b9 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -10,6 +10,7 @@
#include <net/if.h>
#include <net/if_types.h>
+#include <net/netisr.h>
#include <net/route.h>
#ifdef INET
@@ -228,3 +229,34 @@ mpeioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
return (error);
}
+
+void
+mpe_input(struct mbuf *m)
+{
+ 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);
+ }
+
+
+#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));
+
+ s = splnet();
+ /*
+ * assume we only get fed ipv4 packets for now.
+ */
+ IF_ENQUEUE(&ipintrq, m);
+ schednetisr(NETISR_IP);
+ splx(s);
+}
diff --git a/sys/netmpls/mpls.h b/sys/netmpls/mpls.h
index e65ecd470e0..45185c8bc46 100644
--- a/sys/netmpls/mpls.h
+++ b/sys/netmpls/mpls.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls.h,v 1.7 2008/05/07 07:16:49 pyr Exp $ */
+/* $OpenBSD: mpls.h,v 1.8 2008/05/07 08:00:50 pyr Exp $ */
/*
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
@@ -152,6 +152,8 @@ struct mpe_softc {
#define MPE_MTU_MIN 256
#define MPE_MTU_MAX 8192
+void mpe_input(struct mbuf *);
+
extern int mpls_raw_usrreq(struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *);