summaryrefslogtreecommitdiff
path: root/sys/net/if_mpe.c
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 /sys/net/if_mpe.c
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@
Diffstat (limited to 'sys/net/if_mpe.c')
-rw-r--r--sys/net/if_mpe.c32
1 files changed, 32 insertions, 0 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);
+}