VLIB_NODE_FN (ip4_lookup_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
- return ip4_lookup_inline (vm, node, frame,
- /* lookup_for_responses_to_locally_received_packets */
- 0);
-
+ return ip4_lookup_inline (vm, node, frame);
}
static u8 *format_ip4_lookup_trace (u8 * s, va_list * args);
vnet_buffer (b)->sw_if_index[VLIB_TX] != ~0 ?
vnet_buffer (b)->sw_if_index[VLIB_TX] : vnet_buffer (b)->ip.fib_index;
+ /*
+ * vnet_buffer()->ip.adj_index[VLIB_RX] will be set to the index of the
+ * adjacency for the destination address (the local interface address).
+ * vnet_buffer()->ip.adj_index[VLIB_TX] will be set to the index of the
+ * adjacency for the source address (the remote sender's address)
+ */
if (PREDICT_FALSE (last_check->first ||
(last_check->src.as_u32 != ip0->src_address.as_u32)))
{
leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 3);
lbi0 = ip4_fib_mtrie_leaf_get_adj_index (leaf0);
+ vnet_buffer (b)->ip.adj_index[VLIB_RX] =
+ vnet_buffer (b)->ip.adj_index[VLIB_TX];
vnet_buffer (b)->ip.adj_index[VLIB_TX] = lbi0;
- vnet_buffer (b)->ip.adj_index[VLIB_RX] = lbi0;
lb0 = load_balance_get (lbi0);
dpo0 = load_balance_get_bucket_i (lb0, 0);
}
else
{
+ vnet_buffer (b)->ip.adj_index[VLIB_RX] =
+ vnet_buffer (b)->ip.adj_index[VLIB_TX];
vnet_buffer (b)->ip.adj_index[VLIB_TX] = last_check->lbi;
- vnet_buffer (b)->ip.adj_index[VLIB_RX] = last_check->lbi;
*error0 = last_check->error;
last_check->first = 0;
}
vnet_buffer (b[1])->sw_if_index[VLIB_TX] :
vnet_buffer (b[1])->ip.fib_index;
+ /*
+ * vnet_buffer()->ip.adj_index[VLIB_RX] will be set to the index of the
+ * adjacency for the destination address (the local interface address).
+ * vnet_buffer()->ip.adj_index[VLIB_TX] will be set to the index of the
+ * adjacency for the source address (the remote sender's address)
+ */
if (PREDICT_FALSE (not_last_hit))
{
mtrie[0] = &ip4_fib_get (vnet_buffer (b[0])->ip.fib_index)->mtrie;
lbi[0] = ip4_fib_mtrie_leaf_get_adj_index (leaf[0]);
lbi[1] = ip4_fib_mtrie_leaf_get_adj_index (leaf[1]);
+ vnet_buffer (b[0])->ip.adj_index[VLIB_RX] =
+ vnet_buffer (b[0])->ip.adj_index[VLIB_TX];
vnet_buffer (b[0])->ip.adj_index[VLIB_TX] = lbi[0];
- vnet_buffer (b[0])->ip.adj_index[VLIB_RX] = lbi[0];
+ vnet_buffer (b[1])->ip.adj_index[VLIB_RX] =
+ vnet_buffer (b[1])->ip.adj_index[VLIB_TX];
vnet_buffer (b[1])->ip.adj_index[VLIB_TX] = lbi[1];
- vnet_buffer (b[1])->ip.adj_index[VLIB_RX] = lbi[1];
lb[0] = load_balance_get (lbi[0]);
lb[1] = load_balance_get (lbi[1]);
}
else
{
+ vnet_buffer (b[0])->ip.adj_index[VLIB_RX] =
+ vnet_buffer (b[0])->ip.adj_index[VLIB_TX];
vnet_buffer (b[0])->ip.adj_index[VLIB_TX] = last_check->lbi;
- vnet_buffer (b[0])->ip.adj_index[VLIB_RX] = last_check->lbi;
+ vnet_buffer (b[1])->ip.adj_index[VLIB_RX] =
+ vnet_buffer (b[1])->ip.adj_index[VLIB_TX];
vnet_buffer (b[1])->ip.adj_index[VLIB_TX] = last_check->lbi;
- vnet_buffer (b[1])->ip.adj_index[VLIB_RX] = last_check->lbi;
error[0] = last_check->error;
error[1] = last_check->error;
lm->local_next_by_ip_protocol[protocol] =
vlib_node_add_next (vm, ip4_local_node.index, node_index);
}
+
+void
+ip4_unregister_protocol (u32 protocol)
+{
+ ip4_main_t *im = &ip4_main;
+ ip_lookup_main_t *lm = &im->lookup_main;
+
+ ASSERT (protocol < ARRAY_LEN (lm->local_next_by_ip_protocol));
+ lm->local_next_by_ip_protocol[protocol] = IP_LOCAL_NEXT_PUNT;
+}
#endif
static clib_error_t *
u32 node_index = vlib_get_node (vm,
ip4_local_node.index)->
next_nodes[lm->local_next_by_ip_protocol[i]];
- vlib_cli_output (vm, "%d: %U", i, format_vlib_node_name, vm,
- node_index);
+ vlib_cli_output (vm, "%U: %U", format_ip_protocol, i,
+ format_vlib_node_name, vm, node_index);
}
}
return 0;