diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netmpls/mpls.h | 17 | ||||
-rw-r--r-- | sys/netmpls/mpls_input.c | 18 | ||||
-rw-r--r-- | sys/netmpls/mpls_output.c | 17 | ||||
-rw-r--r-- | sys/netmpls/mpls_proto.c | 4 | ||||
-rw-r--r-- | sys/netmpls/mpls_shim.c | 4 |
5 files changed, 23 insertions, 37 deletions
diff --git a/sys/netmpls/mpls.h b/sys/netmpls/mpls.h index 03017c9b63c..1553a538945 100644 --- a/sys/netmpls/mpls.h +++ b/sys/netmpls/mpls.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls.h,v 1.14 2008/11/01 16:37:55 michele Exp $ */ +/* $OpenBSD: mpls.h,v 1.15 2008/12/15 16:13:55 michele Exp $ */ /* * Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project. @@ -87,22 +87,13 @@ struct shim_hdr { struct sockaddr_mpls { u_int8_t smpls_len; /* length */ u_int8_t smpls_family; /* AF_MPLS */ - u_int8_t smpls_operation; - u_int8_t smpls_out_exp; /* outgoing exp value */ u_int32_t smpls_out_label; /* outgoing MPLS label */ - u_int16_t smpls_out_ifindex; - u_int16_t smpls_in_ifindex; u_int32_t smpls_in_label; /* MPLS label 20 bits*/ -#if MPLS_MCAST - u_int8_t smpls_mcexp; - u_int8_t smpls_pad2[2]; - u_int32_t smpls_mclabel; -#endif }; -#define MPLS_OP_POP 1 -#define MPLS_OP_PUSH 2 -#define MPLS_OP_SWAP 3 +#define MPLS_OP_POP RTF_PROTO1 +#define MPLS_OP_PUSH RTF_PROTO2 +#define MPLS_OP_SWAP RTF_PROTO3 #define MPLS_INKERNEL_LOOP_MAX 16 diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c index e267fd9ea1b..5df12744427 100644 --- a/sys/netmpls/mpls_input.c +++ b/sys/netmpls/mpls_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_input.c,v 1.15 2008/11/01 16:37:55 michele Exp $ */ +/* $OpenBSD: mpls_input.c,v 1.16 2008/12/15 16:13:55 michele Exp $ */ /* * Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org> @@ -118,14 +118,13 @@ mpls_input(struct mbuf *m) smpls = &sa_mpls; smpls->smpls_family = AF_MPLS; smpls->smpls_len = sizeof(*smpls); - smpls->smpls_in_ifindex = ifp->if_index; smpls->smpls_in_label = shim->shim_label & MPLS_LABEL_MASK; #ifdef MPLS_DEBUG printf("smpls af %d len %d in_label %d in_ifindex %d\n", smpls->smpls_family, smpls->smpls_len, MPLS_LABEL_GET(smpls->smpls_in_label), - smpls->smpls_in_ifindex); + ifp->if_index); #endif if (ntohl(smpls->smpls_in_label) < MPLS_LABEL_RESERVED_MAX) { @@ -166,18 +165,17 @@ mpls_input(struct mbuf *m) rt->rt_use++; smpls = satosmpls(rt_key(rt)); + #ifdef MPLS_DEBUG printf("route af %d len %d in_label %d in_ifindex %d\n", smpls->smpls_family, smpls->smpls_len, MPLS_LABEL_GET(smpls->smpls_in_label), - smpls->smpls_in_ifindex); - printf("\top %d out_label %d out_ifindex %d\n", - smpls->smpls_operation, - MPLS_LABEL_GET(smpls->smpls_out_label), - smpls->smpls_out_ifindex); + ifp->if_index); #endif - switch (smpls->smpls_operation) { + switch (rt->rt_flags & (MPLS_OP_PUSH | MPLS_OP_POP | + MPLS_OP_SWAP)){ + case MPLS_OP_POP: hasbos = MPLS_BOS_ISSET(shim->shim_label); m = mpls_shim_pop(m); @@ -211,7 +209,7 @@ mpls_input(struct mbuf *m) shim = mtod(m, struct shim_hdr *); ifp = rt->rt_ifp; - if (smpls->smpls_out_ifindex) + if (ifp != NULL) break; RTFREE(rt); diff --git a/sys/netmpls/mpls_output.c b/sys/netmpls/mpls_output.c index 66ef313510b..03591baa0e6 100644 --- a/sys/netmpls/mpls_output.c +++ b/sys/netmpls/mpls_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_output.c,v 1.2 2008/11/06 19:32:51 michele Exp $ */ +/* $OpenBSD: mpls_output.c,v 1.3 2008/12/15 16:13:55 michele Exp $ */ /* * Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org> @@ -66,14 +66,13 @@ mpls_output(struct mbuf *m) smpls = &sa_mpls; smpls->smpls_family = AF_MPLS; smpls->smpls_len = sizeof(*smpls); - smpls->smpls_in_ifindex = ifp->if_index; smpls->smpls_in_label = shim->shim_label & MPLS_LABEL_MASK; #ifdef MPLS_DEBUG printf("smpls af %d len %d in_label %d in_ifindex %d\n", smpls->smpls_family, smpls->smpls_len, MPLS_LABEL_GET(smpls->smpls_in_label), - smpls->smpls_in_ifindex); + ifp->if_index); #endif rt = rtalloc1(smplstosa(smpls), 1, 0); @@ -94,14 +93,12 @@ mpls_output(struct mbuf *m) printf("route af %d len %d in_label %d in_ifindex %d\n", smpls->smpls_family, smpls->smpls_len, MPLS_LABEL_GET(smpls->smpls_in_label), - smpls->smpls_in_ifindex); - printf("\top %d out_label %d out_ifindex %d\n", - smpls->smpls_operation, - MPLS_LABEL_GET(smpls->smpls_out_label), - smpls->smpls_out_ifindex); + ifp->if_index); #endif - switch (smpls->smpls_operation) { + switch (rt->rt_flags & (MPLS_OP_PUSH | MPLS_OP_POP | + MPLS_OP_SWAP)) { + case MPLS_OP_POP: if (MPLS_BOS_ISSET(shim->shim_label)) { /* drop to avoid loops */ @@ -129,7 +126,7 @@ mpls_output(struct mbuf *m) shim = mtod(m, struct shim_hdr *); ifp = rt->rt_ifp; - if (smpls->smpls_out_ifindex) + if (ifp != NULL) break; RTFREE(rt); diff --git a/sys/netmpls/mpls_proto.c b/sys/netmpls/mpls_proto.c index f3e4f510f3c..d2e987ca0df 100644 --- a/sys/netmpls/mpls_proto.c +++ b/sys/netmpls/mpls_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_proto.c,v 1.2 2008/04/23 11:22:23 norby Exp $ */ +/* $OpenBSD: mpls_proto.c,v 1.3 2008/12/15 16:13:55 michele Exp $ */ /* * Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project. @@ -71,6 +71,6 @@ struct domain mplsdomain = { mplssw, &mplssw[sizeof(mplssw)/sizeof(mplssw[0])], 0, rn_inithead, - offsetof(struct sockaddr_mpls, smpls_in_ifindex) << 3, + offsetof(struct sockaddr_mpls, smpls_in_label) << 3, sizeof(struct sockaddr_mpls) }; diff --git a/sys/netmpls/mpls_shim.c b/sys/netmpls/mpls_shim.c index be8e888d140..4152dd07da2 100644 --- a/sys/netmpls/mpls_shim.c +++ b/sys/netmpls/mpls_shim.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_shim.c,v 1.3 2008/05/02 12:37:08 claudio Exp $ */ +/* $OpenBSD: mpls_shim.c,v 1.4 2008/12/15 16:13:55 michele Exp $ */ /* * Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project. @@ -77,7 +77,7 @@ mpls_shim_swap(struct mbuf *m, struct sockaddr_mpls *smplsp) u_int32_t t; shim->shim_label &= ~MPLS_EXP_MASK; - t = smplsp->smpls_out_exp << MPLS_EXP_OFFSET; + t = 0; shim->shim_label |= htonl(t) & MPLS_EXP_MASK; } |