From 51b1a2f219c01a61761ff951922c685c0f760512 Mon Sep 17 00:00:00 2001 From: Michele Marchetto Date: Wed, 29 Apr 2009 19:26:53 +0000 Subject: 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@ --- sys/netmpls/mpls_input.c | 22 +++------------------- sys/netmpls/mpls_output.c | 8 +++++--- 2 files changed, 8 insertions(+), 22 deletions(-) (limited to 'sys') 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 @@ -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; diff --git a/sys/netmpls/mpls_output.c b/sys/netmpls/mpls_output.c index a564f28bac8..8e21cf87466 100644 --- a/sys/netmpls/mpls_output.c +++ b/sys/netmpls/mpls_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_output.c,v 1.5 2009/01/28 22:18:44 michele Exp $ */ +/* $OpenBSD: mpls_output.c,v 1.6 2009/04/29 19:26:52 michele Exp $ */ /* * Copyright (c) 2008 Claudio Jeker @@ -92,9 +92,11 @@ mpls_output(struct mbuf *m, struct rtentry *rt0) m = mpls_shim_push(m, rt_mpls); break; case MPLS_OP_POP: + m = mpls_shim_pop(m); + break; case MPLS_OP_SWAP: - /* We are entring a LSP. There isn't anything to pop - or swap yet. */ + m = mpls_shim_swap(m, rt_mpls); + break; default: m_freem(m); goto bad; -- cgit v1.2.3