summaryrefslogtreecommitdiffstats
path: root/sys/netmpls/mpls_input.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2008-05-02 12:40:29 +0000
committerclaudio <claudio@openbsd.org>2008-05-02 12:40:29 +0000
commit153b928a3cc0232e0d697a9daffc482a92456740 (patch)
tree9b1a5285d572e7160ba7011d95879fcca16836e7 /sys/netmpls/mpls_input.c
parentThere is no need to endian convert the label after swapping it, all label ops (diff)
downloadwireguard-openbsd-153b928a3cc0232e0d697a9daffc482a92456740.tar.xz
wireguard-openbsd-153b928a3cc0232e0d697a9daffc482a92456740.zip
Fix the label swithing and forwarding logic a bit. OK norby@
Diffstat (limited to 'sys/netmpls/mpls_input.c')
-rw-r--r--sys/netmpls/mpls_input.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index 6bcd9299543..ffac6f3228a 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.5 2008/04/30 07:39:48 norby Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.6 2008/05/02 12:40:29 claudio Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -157,15 +157,22 @@ printf("\top %d out_label %d out_ifindex %d\n", smpls->smpls_operation,
m = mpls_shim_swap(m, smpls);
break;
default:
- break;
+ m_freem(m);
+ goto done;
}
- break;
- /* not yet done with packet */
- if (rt) {
- RTFREE(rt);
- rt = NULL;
- }
+ if (m == NULL)
+ goto done;
+
+ /* refetch label */
+ shim = mtod(m, struct shim_hdr *);
+ ifp = rt->rt_ifp;
+
+ if (smpls->smpls_out_ifindex)
+ break;
+
+ RTFREE(rt);
+ rt = NULL;
}
/* write back TTL */