summaryrefslogtreecommitdiff
path: root/sys/netmpls
diff options
context:
space:
mode:
authorMichele Marchetto <michele@cvs.openbsd.org>2008-10-14 20:43:34 +0000
committerMichele Marchetto <michele@cvs.openbsd.org>2008-10-14 20:43:34 +0000
commit9c7f701201d27ef2d5880d01479515e3abbcc287 (patch)
tree0f62659741261c12b6be76bd8c4b37ce5772c752 /sys/netmpls
parent842c943d0b9533fb5f723d2e8d941739ee0898a8 (diff)
Now mpls_input() handles ipv4 and ipv6 explicit null labels.
Added mpe_input6 to manage also ipv6 packets insted of just ipv4 ones. OK claudio@ laurent@
Diffstat (limited to 'sys/netmpls')
-rw-r--r--sys/netmpls/mpls.h4
-rw-r--r--sys/netmpls/mpls_input.c29
2 files changed, 30 insertions, 3 deletions
diff --git a/sys/netmpls/mpls.h b/sys/netmpls/mpls.h
index 8858864d74b..0ad5fe11457 100644
--- a/sys/netmpls/mpls.h
+++ b/sys/netmpls/mpls.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls.h,v 1.11 2008/05/23 16:03:03 thib Exp $ */
+/* $OpenBSD: mpls.h,v 1.12 2008/10/14 20:43:33 michele Exp $ */
/*
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
@@ -152,6 +152,8 @@ struct mpe_softc {
void mpe_input(struct mbuf *, struct ifnet *, struct sockaddr_mpls *,
u_int32_t);
+void mpe_input6(struct mbuf *, struct ifnet *, struct sockaddr_mpls *,
+ u_int32_t);
extern int mpls_raw_usrreq(struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *, struct proc *);
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index e95c19db693..39ff4c621b6 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.13 2008/05/23 16:06:29 thib Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.14 2008/10/14 20:43:33 michele Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -128,7 +128,32 @@ mpls_input(struct mbuf *m)
smpls->smpls_in_ifindex);
#endif
- rt = rtalloc1(smplstosa(smpls),1, 0);
+ if (ntohl(smpls->smpls_in_label) < MPLS_LABEL_RESERVED_MAX) {
+
+ hasbos = MPLS_BOS_ISSET(shim->shim_label);
+ m = mpls_shim_pop(m);
+ shim = mtod(m, struct shim_hdr *);
+
+ switch (ntohl(smpls->smpls_in_label)) {
+
+ case MPLS_LABEL_IPV4NULL:
+ if (hasbos) {
+ mpe_input(m, NULL, smpls, ttl);
+ goto done;
+ } else
+ continue;
+
+ case MPLS_LABEL_IPV6NULL:
+ if (hasbos) {
+ mpe_input6(m, NULL, smpls, ttl);
+ goto done;
+ } else
+ continue;
+ }
+ /* Other cases are not handled for now */
+ }
+
+ rt = rtalloc1(smplstosa(smpls), 1, 0);
if (rt == NULL) {
/* no entry for this label */