summaryrefslogtreecommitdiffstats
path: root/sys/netmpls/mpls_input.c
diff options
context:
space:
mode:
authormichele <michele@openbsd.org>2009-04-29 19:26:52 +0000
committermichele <michele@openbsd.org>2009-04-29 19:26:52 +0000
commitdc9da2d3a6c192ca187a749468ea6ae9d5e6a636 (patch)
treef5f1f0f43f1334ed24ac0d593acb874a1c661bfb /sys/netmpls/mpls_input.c
parentdocument that bogus lines are silently ignored (diff)
downloadwireguard-openbsd-dc9da2d3a6c192ca187a749468ea6ae9d5e6a636.tar.xz
wireguard-openbsd-dc9da2d3a6c192ca187a749468ea6ae9d5e6a636.zip
Split up functionalities between mpls_input and mpls_output.
The former is responsible to handle packets destined to localhost, the latter handles packet that have to be forwarded or the ones originated from localhost. "i like it" claudio@
Diffstat (limited to 'sys/netmpls/mpls_input.c')
-rw-r--r--sys/netmpls/mpls_input.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index 1a9c3156f93..1e34fa4d989 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.20 2009/04/28 12:07:43 michele Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.21 2009/04/29 19:26:52 michele Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -232,13 +232,10 @@ mpls_input(struct mbuf *m)
goto done;
}
- switch (rt_mpls->mpls_operation & (MPLS_OP_PUSH | MPLS_OP_POP |
- MPLS_OP_SWAP)){
-
- case MPLS_OP_POP:
+ if (rt_mpls->mpls_operation & MPLS_OP_POP) {
hasbos = MPLS_BOS_ISSET(shim->shim_label);
- m = mpls_shim_pop(m);
if (hasbos) {
+ m = mpls_shim_pop(m);
#if NMPE > 0
if (rt->rt_ifp->if_type == IFT_MPLS) {
mpe_input(m, rt->rt_ifp, smpls, ttl);
@@ -249,21 +246,8 @@ mpls_input(struct mbuf *m)
m_freem(m);
goto done;
}
- break;
- case MPLS_OP_PUSH:
- m = mpls_shim_push(m, rt_mpls);
- break;
- case MPLS_OP_SWAP:
- m = mpls_shim_swap(m, rt_mpls);
- break;
- default:
- m_freem(m);
- goto done;
}
- if (m == NULL)
- goto done;
-
/* refetch label */
shim = mtod(m, struct shim_hdr *);
ifp = rt->rt_ifp;