path_ext = fib_path_ext_list_find_by_path_index(&ctx->mt->mt_path_exts,
path_index);
+ /*
+ * we don't want IP TTL decrements for packets hitting the MPLS labels
+ * we stack on, since the IP TTL decrement is done by the adj
+ */
+ path_ext->fpe_mpls_flags |= FIB_PATH_EXT_MPLS_FLAG_NO_IP_TTL_DECR;
+
if (NULL != path_ext)
{
/*
mpls_tunnel_mk_lb(mt,
adj->ia_link,
- (VNET_LINK_MPLS == adj_get_link_type(ai) ?
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS:
- FIB_FORW_CHAIN_TYPE_MPLS_EOS),
+ fib_forw_chain_type_from_link_type(
+ adj_get_link_type(ai)),
&dpo);
adj_nbr_midchain_stack(ai, &dpo);
static void
mpls_tunnel_fixup (vlib_main_t *vm,
ip_adjacency_t *adj,
- vlib_buffer_t *b0)
+ vlib_buffer_t *b0,
+ const void*data)
{
/*
* A no-op w.r.t. the header. but reset the 'have we pushed any
case IP_LOOKUP_NEXT_ARP:
case IP_LOOKUP_NEXT_GLEAN:
adj_nbr_midchain_update_rewrite(ai, mpls_tunnel_fixup,
+ NULL,
ADJ_FLAG_NONE,
mpls_tunnel_build_rewrite_i());
break;
* There's no MAC fixup, so the last 2 parameters are 0
*/
adj_mcast_midchain_update_rewrite(ai, mpls_tunnel_fixup,
+ NULL,
ADJ_FLAG_NONE,
mpls_tunnel_build_rewrite_i(),
0, 0);
b0 = vlib_get_buffer(vm, bi0);
vnet_buffer(b0)->ip.adj_index[VLIB_TX] = mt->mt_l2_lb.dpoi_index;
+ /* since we are coming out of the L2 world, where the vlib_buffer
+ * union is used for other things, make sure it is clean for
+ * MPLS from now on.
+ */
+ vnet_buffer(b0)->mpls.first = 0;
if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
{
static mpls_tunnel_t *
mpls_tunnel_from_fib_node (fib_node_t *node)
{
-#if (CLIB_DEBUG > 0)
ASSERT(FIB_NODE_TYPE_MPLS_TUNNEL == node->fn_type);
-#endif
return ((mpls_tunnel_t*) (((char*)node) -
STRUCT_OFFSET_OF(mpls_tunnel_t, mt_node)));
}