summaryrefslogtreecommitdiffstats
path: root/sys/netmpls
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2010-10-07 12:34:15 +0000
committerclaudio <claudio@openbsd.org>2010-10-07 12:34:15 +0000
commit1d407297424dca6adacddd08a9c4f9ab99c401e6 (patch)
tree48df214b8b79355711b2619e37c79e716c02565c /sys/netmpls
parentnroff doesn't like long argument lists that work fine with mandoc. (diff)
downloadwireguard-openbsd-1d407297424dca6adacddd08a9c4f9ab99c401e6.tar.xz
wireguard-openbsd-1d407297424dca6adacddd08a9c4f9ab99c401e6.zip
Handle IMPLNULL labels (#3) directly in the kernel like we do with the
explicit NULL labels. IMPLNULL labels should never ever be seen on the wire but we're realists. michele@ agrees
Diffstat (limited to 'sys/netmpls')
-rw-r--r--sys/netmpls/mpls_input.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index 1c6df4a288c..9f162321d27 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.29 2010/09/13 10:02:49 claudio Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.30 2010/10/07 12:34:15 claudio Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -161,6 +161,7 @@ mpls_input(struct mbuf *m)
* to be at the beginning of the stack.
*/
if (hasbos) {
+do_v4:
if (mpls_ip_adjttl(m, ttl))
goto done;
s = splnet();
@@ -168,10 +169,11 @@ mpls_input(struct mbuf *m)
schednetisr(NETISR_IP);
splx(s);
goto done;
- } else
- continue;
+ }
+ continue;
case MPLS_LABEL_IPV6NULL:
if (hasbos) {
+do_v6:
if (mpls_ip6_adjttl(m, ttl))
goto done;
s = splnet();
@@ -179,13 +181,26 @@ mpls_input(struct mbuf *m)
schednetisr(NETISR_IPV6);
splx(s);
goto done;
- } else
- continue;
+ }
+ continue;
+ case MPLS_LABEL_IMPLNULL:
+ if (hasbos) {
+ switch (*mtod(m, u_char *) >> 4) {
+ case IPVERSION:
+ goto do_v4;
+ case IPV6_VERSION >> 4:
+ goto do_v6;
+ default:
+ m_freem(m);
+ goto done;
+ }
+ }
+ /* FALLTHROUGH */
default:
+ /* Other cases are not handled for now */
m_freem(m);
goto done;
}
- /* Other cases are not handled for now */
}
rt = rtalloc1(smplstosa(smpls), RT_REPORT, 0);