summaryrefslogtreecommitdiff
path: root/sys/netmpls/mpls_input.c
diff options
context:
space:
mode:
authorMichele Marchetto <michele@cvs.openbsd.org>2009-01-08 12:47:46 +0000
committerMichele Marchetto <michele@cvs.openbsd.org>2009-01-08 12:47:46 +0000
commit9f7c3133fa3ada0c6c2f725ce1bcc2006c244120 (patch)
treebe7127edb0b27b212fbe39fb44aff27ff2868d97 /sys/netmpls/mpls_input.c
parentf4ea0dc4cd832d8220a0e28e73e5b23280105bda (diff)
Fix sockaddr_mpls structure.
Now it contains just the label as it must be. This introduces a ugly hack in rtentry that will be removed as soon as possible. OK claudio@
Diffstat (limited to 'sys/netmpls/mpls_input.c')
-rw-r--r--sys/netmpls/mpls_input.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index 5df12744427..9382aa6f9cb 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.16 2008/12/15 16:13:55 michele Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.17 2009/01/08 12:47:45 michele Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -70,7 +70,8 @@ mpls_input(struct mbuf *m)
{
struct ifnet *ifp = m->m_pkthdr.rcvif;
struct sockaddr_mpls *smpls;
- struct sockaddr_mpls sa_mpls;
+ struct sockaddr_mpls *newsmpls;
+ struct sockaddr_mpls sa_mpls, sa_outmpls;
struct shim_hdr *shim;
struct rtentry *rt = NULL;
u_int8_t ttl;
@@ -91,6 +92,11 @@ mpls_input(struct mbuf *m)
if ((m = m_pullup(m, sizeof(*shim))) == NULL)
return;
+ bzero(&sa_outmpls, sizeof(sa_outmpls));
+ newsmpls = &sa_outmpls;
+ newsmpls->smpls_family = AF_MPLS;
+ newsmpls->smpls_len = sizeof(*smpls);
+
shim = mtod(m, struct shim_hdr *);
#ifdef MPLS_DEBUG
@@ -118,22 +124,22 @@ mpls_input(struct mbuf *m)
smpls = &sa_mpls;
smpls->smpls_family = AF_MPLS;
smpls->smpls_len = sizeof(*smpls);
- smpls->smpls_in_label = shim->shim_label & MPLS_LABEL_MASK;
+ smpls->smpls_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),
+ MPLS_LABEL_GET(smpls->smpls_label),
ifp->if_index);
#endif
- if (ntohl(smpls->smpls_in_label) < MPLS_LABEL_RESERVED_MAX) {
+ 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 *);
- switch (ntohl(smpls->smpls_in_label)) {
+ switch (ntohl(smpls->smpls_label)) {
case MPLS_LABEL_IPV4NULL:
if (hasbos) {
@@ -165,13 +171,7 @@ 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),
- ifp->if_index);
-#endif
+ newsmpls->smpls_label = rt->rt_mpls;
switch (rt->rt_flags & (MPLS_OP_PUSH | MPLS_OP_POP |
MPLS_OP_SWAP)){
@@ -192,10 +192,10 @@ mpls_input(struct mbuf *m)
}
break;
case MPLS_OP_PUSH:
- m = mpls_shim_push(m, smpls);
+ m = mpls_shim_push(m, newsmpls);
break;
case MPLS_OP_SWAP:
- m = mpls_shim_swap(m, smpls);
+ m = mpls_shim_swap(m, newsmpls);
break;
default:
m_freem(m);
@@ -222,8 +222,8 @@ mpls_input(struct mbuf *m)
#ifdef MPLS_DEBUG
printf("MPLS: sending on %s outlabel %x dst af %d in %d out %d\n",
ifp->if_xname, ntohl(shim->shim_label), smpls->smpls_family,
- MPLS_LABEL_GET(smpls->smpls_in_label),
- MPLS_LABEL_GET(smpls->smpls_out_label));
+ MPLS_LABEL_GET(smpls->smpls_label),
+ MPLS_LABEL_GET(newsmpls->smpls_label));
#endif
(*ifp->if_output)(ifp, m, smplstosa(smpls), rt);