summaryrefslogtreecommitdiffstats
path: root/sys/netmpls/mpls_input.c
diff options
context:
space:
mode:
authormichele <michele@openbsd.org>2008-11-01 16:37:55 +0000
committermichele <michele@openbsd.org>2008-11-01 16:37:55 +0000
commit8b3356d2efa0e4ba24808ca565a9571ff3223da5 (patch)
tree121a7125c2541e52e318fceda6c0225e672ed962 /sys/netmpls/mpls_input.c
parentmake usage() a fatal function instead of a string. It is just used once, (diff)
downloadwireguard-openbsd-8b3356d2efa0e4ba24808ca565a9571ff3223da5.tar.xz
wireguard-openbsd-8b3356d2efa0e4ba24808ca565a9571ff3223da5.zip
Introduced Uniform Model for TTL handling.
MPLS TTL is mapped into network layer one as the packet exits the LSP. Just IPv4 support for now. Added the relevant sysctls to enable this behaviour. Input and OK claudio@
Diffstat (limited to 'sys/netmpls/mpls_input.c')
-rw-r--r--sys/netmpls/mpls_input.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index 39ff4c621b6..e267fd9ea1b 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.14 2008/10/14 20:43:33 michele Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.15 2008/11/01 16:37:55 michele Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -71,9 +71,9 @@ mpls_input(struct mbuf *m)
struct ifnet *ifp = m->m_pkthdr.rcvif;
struct sockaddr_mpls *smpls;
struct sockaddr_mpls sa_mpls;
- struct shim_hdr *shim;
+ struct shim_hdr *shim;
struct rtentry *rt = NULL;
- u_int32_t ttl;
+ u_int8_t ttl;
int i, hasbos;
if (!mpls_enable) {
@@ -111,7 +111,7 @@ mpls_input(struct mbuf *m)
m_freem(m);
return;
}
- ttl = htonl(ttl - 1);
+ ttl--;
for (i = 0; i < mpls_inkloop; i++) {
bzero(&sa_mpls, sizeof(sa_mpls));
@@ -219,7 +219,7 @@ mpls_input(struct mbuf *m)
}
/* write back TTL */
- shim->shim_label = (shim->shim_label & ~MPLS_TTL_MASK) | ttl;
+ shim->shim_label = (shim->shim_label & ~MPLS_TTL_MASK) | htonl(ttl);
#ifdef MPLS_DEBUG
printf("MPLS: sending on %s outlabel %x dst af %d in %d out %d\n",