summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2018-11-11 12:47:05 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2018-11-11 12:47:05 +0000
commitffd82549a04a56e763a7394b3bffa0cf7d87e8d2 (patch)
treeb875186de6aa3a4c365ef3353a4c4198a5715728
parentd9144f7fb3648891a24285bd03713553d6699068 (diff)
copy the mpls cos and use it as the ip dscp/tos/tclass thing.
-rw-r--r--sys/net/if_gif.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 1741a03c915..3758d4bbcbd 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.116 2018/04/18 13:24:07 bluhm Exp $ */
+/* $OpenBSD: if_gif.c,v 1.117 2018/11/11 12:47:04 dlg Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -255,21 +255,28 @@ gif_start(struct ifnet *ifp)
}
#endif
#ifdef MPLS
- case AF_MPLS:
+ case AF_MPLS: {
+ uint32_t shim;
+
+ m = m_pullup(m, sizeof(shim));
+ if (m == NULL)
+ continue;
+
+ shim = bemtoh32(mtod(m, uint32_t *)) & MPLS_EXP_MASK;
+ tos = (shim >> MPLS_EXP_OFFSET) << 5;
+
ttloff = 3;
- tos = 0;
proto = IPPROTO_MPLS;
break;
+ }
#endif
default:
unhandled_af(m->m_pkthdr.ph_family);
}
if (tttl == -1) {
- m = m_pullup(m, ttloff + 1);
- if (m == NULL)
- continue;
+ KASSERT(m->m_len > ttloff);
ttl = *(m->m_data + ttloff);
} else