diff options
author | Michele Marchetto <michele@cvs.openbsd.org> | 2009-04-28 12:07:44 +0000 |
---|---|---|
committer | Michele Marchetto <michele@cvs.openbsd.org> | 2009-04-28 12:07:44 +0000 |
commit | 6bcde5d977a5f0f33a32ea5c22cfe7999c602030 (patch) | |
tree | bbca7a15827c16352c564b77c4b0276d959736d5 /sys/netmpls | |
parent | c90cd2ab0ada389eb4df0c2cf2b7313f41b7c5c8 (diff) |
Introduce a new dummy operation to easily handle packets that have to leave
the MPLS cloud and join ipv4/ipv6 stack.
ok claudio@ laurent@
Diffstat (limited to 'sys/netmpls')
-rw-r--r-- | sys/netmpls/mpls.h | 3 | ||||
-rw-r--r-- | sys/netmpls/mpls_input.c | 24 |
2 files changed, 22 insertions, 5 deletions
diff --git a/sys/netmpls/mpls.h b/sys/netmpls/mpls.h index 666749a1fe1..949b0a110bb 100644 --- a/sys/netmpls/mpls.h +++ b/sys/netmpls/mpls.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls.h,v 1.20 2009/04/17 12:10:08 michele Exp $ */ +/* $OpenBSD: mpls.h,v 1.21 2009/04/28 12:07:43 michele Exp $ */ /* * Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project. @@ -100,6 +100,7 @@ struct rt_mpls { u_int8_t mpls_exp; }; +#define MPLS_OP_LOCAL 0x0 #define MPLS_OP_POP 0x1 #define MPLS_OP_PUSH 0x2 #define MPLS_OP_SWAP 0x4 diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c index eabfc12e693..1a9c3156f93 100644 --- a/sys/netmpls/mpls_input.c +++ b/sys/netmpls/mpls_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_input.c,v 1.19 2009/04/17 12:10:08 michele Exp $ */ +/* $OpenBSD: mpls_input.c,v 1.20 2009/04/28 12:07:43 michele Exp $ */ /* * Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org> @@ -147,7 +147,6 @@ mpls_input(struct mbuf *m) #endif if (ntohl(smpls->smpls_label) < MPLS_LABEL_RESERVED_MAX) { - hasbos = MPLS_BOS_ISSET(shim->shim_label); m = mpls_shim_pop(m); shim = mtod(m, struct shim_hdr *); @@ -190,12 +189,29 @@ mpls_input(struct mbuf *m) rt_mpls = (struct rt_mpls *)rt->rt_llinfo; if (rt_mpls == NULL || (rt->rt_flags & RTF_MPLS) == 0) { +#ifdef MPLS_DEBUG + printf("MPLS_DEBUG: no MPLS information " + "attached\n"); +#endif + m_freem(m); + goto done; + } + + if (rt_mpls->mpls_operation == MPLS_OP_LOCAL) { /* Packet is for us */ hasbos = MPLS_BOS_ISSET(shim->shim_label); + if (!hasbos) { +#ifdef MPLS_DEBUG + printf("MPLS_DEBUG: packet malformed\n"); +#endif + m_freem(m); + goto done; + } m = mpls_shim_pop(m); - if (!hasbos || !rt->rt_gateway) { + + if (!rt->rt_gateway) { #ifdef MPLS_DEBUG - printf("MPLS_DEBUG: no MPLS information " + printf("MPLS_DEBUG: no layer 3 informations " "attached\n"); #endif m_freem(m); |