summaryrefslogtreecommitdiff
path: root/sys/netmpls
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-10-07 12:34:16 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-10-07 12:34:16 +0000
commit4ed0581ac2030b798ae8386668f27d2918b68009 (patch)
treee88f5e21bae55633d9282a139a88e2b9d267bce3 /sys/netmpls
parent9fc2df24cb586e45a460c3d53821abbb635f10db (diff)
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);