aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c10
-rw-r--r--plugins/ioam-plugin/ioam/lib-pot/pot_util.c3
-rw-r--r--plugins/ioam-plugin/ioam/lib-trace/trace_util.c22
-rw-r--r--vnet/vnet/ip/ip6_forward.c45
-rw-r--r--vnet/vnet/ip/ip6_hop_by_hop.c134
5 files changed, 50 insertions, 164 deletions
diff --git a/plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c b/plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c
index e151a96c010..5c9814051da 100644
--- a/plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c
+++ b/plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c
@@ -45,8 +45,8 @@ extern ip6_main_t ip6_main;
#define foreach_ip6_hop_by_hop_ioam_trace_stats \
_(PROCESSED, "Pkts with ip6 hop-by-hop trace options") \
_(PROFILE_MISS, "Pkts with ip6 hop-by-hop trace options but no profile set") \
- _(PASSED, "Pkts with TRACE in Policy") \
- _(FAILED, "Pkts with TRACE out of Policy")
+ _(UPDATED, "Pkts with trace updated") \
+ _(FULL, "Pkts with trace options but no space")
static char *ip6_hop_by_hop_ioam_trace_stats_strings[] = {
#define _(sym,string) string,
@@ -270,7 +270,11 @@ ip6_hbh_ioam_trace_data_list_handler (vlib_buffer_t * b, ip6_header_t * ip,
*elt = clib_host_to_net_u32 (profile->app_data);
elt++;
}
- ip6_ioam_trace_stats_increment_counter (IP6_IOAM_TRACE_PASSED, 1);
+ ip6_ioam_trace_stats_increment_counter (IP6_IOAM_TRACE_UPDATED, 1);
+ }
+ else
+ {
+ ip6_ioam_trace_stats_increment_counter (IP6_IOAM_TRACE_FULL, 1);
}
return (rv);
}
diff --git a/plugins/ioam-plugin/ioam/lib-pot/pot_util.c b/plugins/ioam-plugin/ioam/lib-pot/pot_util.c
index 893a89cab33..a253ad4130f 100644
--- a/plugins/ioam-plugin/ioam/lib-pot/pot_util.c
+++ b/plugins/ioam-plugin/ioam/lib-pot/pot_util.c
@@ -310,8 +310,7 @@ static clib_error_t *set_pot_profile_command_fn(vlib_main_t * vm,
bits = MAX_BITS;
}
else
- return clib_error_return(0, "unknown input `%U'",
- format_unformat_error, input);
+ break;
}
if (profile_list_name == 0)
{
diff --git a/plugins/ioam-plugin/ioam/lib-trace/trace_util.c b/plugins/ioam-plugin/ioam/lib-trace/trace_util.c
index 9694a751a4f..ca9adcd1225 100644
--- a/plugins/ioam-plugin/ioam/lib-trace/trace_util.c
+++ b/plugins/ioam-plugin/ioam/lib-trace/trace_util.c
@@ -145,8 +145,7 @@ set_trace_profile_command_fn (vlib_main_t * vm,
else if (unformat (input, "node-id 0x%x", &node_id));
else if (unformat (input, "app-data 0x%x", &app_data));
else
- return clib_error_return (0, "unknown input `%U'",
- format_unformat_error, input);
+ break;
}
profile = trace_profile_find ();
if (profile)
@@ -158,11 +157,14 @@ set_trace_profile_command_fn (vlib_main_t * vm,
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (set_trace_profile_command) =
+VLIB_CLI_COMMAND (set_trace_profile_command, static) =
{
-.path = "set ioam-trace profile",.short_help = "set ioam-trace \
- trace-type <0x1f|0x3|0x9|0x11|0x19> trace-elts <nn> trace-tsp <0|1|2|3> node-id <node id in hex> app-data <app_data in hex>",.function = set_trace_profile_command_fn,};
-
+.path = "set ioam-trace profile",
+.short_help = "set ioam-trace \
+ trace-type <0x1f|0x3|0x9|0x11|0x19> trace-elts <nn> trace-tsp <0|1|2|3> \
+ node-id <node id in hex> app-data <app_data in hex>",
+.function = set_trace_profile_command_fn,
+};
/* *INDENT-ON* */
static clib_error_t *
@@ -207,10 +209,12 @@ show_trace_profile_command_fn (vlib_main_t * vm,
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (show_trace_profile_command) =
+VLIB_CLI_COMMAND (show_trace_profile_command, static) =
{
-.path = "show ioam-trace profile",.short_help =
- "show ioam-trace profile",.function = show_trace_profile_command_fn,};
+.path = "show ioam-trace profile",
+.short_help = "show ioam-trace profile",
+.function = show_trace_profile_command_fn,
+};
/* *INDENT-ON* */
/*
diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c
index 2873e2bdaeb..4493cb4cff3 100644
--- a/vnet/vnet/ip/ip6_forward.c
+++ b/vnet/vnet/ip/ip6_forward.c
@@ -164,15 +164,16 @@ ip6_lookup_inline (vlib_main_t * vm,
next1 = dpo1->dpoi_next_node;
/* Only process the HBH Option Header if explicitly configured to do so */
- next0 = ((ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) &&
- im->hbh_enabled) ?
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP :
- next0;
- next1 = ((ip1->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) &&
- im->hbh_enabled) ?
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP :
- next1;
-
+ if (PREDICT_FALSE(ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS))
+ {
+ next0 = (dpo_is_adj(dpo0) && im->hbh_enabled) ?
+ (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP : next0;
+ }
+ if (PREDICT_FALSE(ip1->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS))
+ {
+ next1 = (dpo_is_adj(dpo1) && im->hbh_enabled) ?
+ (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP : next1;
+ }
vnet_buffer (p0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
vnet_buffer (p1)->ip.adj_index[VLIB_TX] = dpo1->dpoi_index;
@@ -271,12 +272,13 @@ ip6_lookup_inline (vlib_main_t * vm,
(vnet_buffer (p0)->ip.flow_hash &
lb0->lb_n_buckets_minus_1));
next0 = dpo0->dpoi_next_node;
- /* Only process the HBH Option Header if explicitly configured to do so */
- next0 = ((ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) &&
- im->hbh_enabled) ?
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP :
- next0;
+ /* Only process the HBH Option Header if explicitly configured to do so */
+ if (PREDICT_FALSE(ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS))
+ {
+ next0 = (dpo_is_adj(dpo0) && im->hbh_enabled) ?
+ (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP : next0;
+ }
vnet_buffer (p0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
vlib_increment_combined_counter
@@ -785,6 +787,7 @@ ip6_load_balance (vlib_main_t * vm,
u32 n_left_from, n_left_to_next, * from, * to_next;
ip_lookup_next_t next;
u32 cpu_index = os_get_cpu_number();
+ ip6_main_t * im = &ip6_main;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -823,8 +826,13 @@ ip6_load_balance (vlib_main_t * vm,
dpo0 = load_balance_get_bucket_i(lb0,
vnet_buffer(p0)->ip.flow_hash &
(lb0->lb_n_buckets - 1));
-
next0 = dpo0->dpoi_next_node;
+ /* Only process the HBH Option Header if explicitly configured to do so */
+ if (PREDICT_FALSE(ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS))
+ {
+ next0 = (dpo_is_adj(dpo0) && im->hbh_enabled) ?
+ (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP : next0;
+ }
vnet_buffer (p0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
vlib_increment_combined_counter
@@ -2410,6 +2418,8 @@ ip6_hop_by_hop (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
b1 = vlib_get_buffer (vm, bi1);
+
+ /* Default use the next_index from the adjacency. A HBH option rarely redirects to a different node */
u32 adj_index0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
ip_adjacency_t *adj0 = ip_get_adjacency(lm, adj_index0);
u32 adj_index1 = vnet_buffer(b1)->ip.adj_index[VLIB_TX];
@@ -2505,9 +2515,12 @@ ip6_hop_by_hop (vlib_main_t * vm,
n_left_to_next -= 1;
b0 = vlib_get_buffer (vm, bi0);
+ /*
+ * Default use the next_index from the adjacency.
+ * A HBH option rarely redirects to a different node
+ */
u32 adj_index0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
ip_adjacency_t *adj0 = ip_get_adjacency(lm, adj_index0);
- /* Default use the next_index from the adjacency. A HBH option rarely redirects to a different node */
next0 = adj0->lookup_next_index;
ip0 = vlib_buffer_get_current (b0);
diff --git a/vnet/vnet/ip/ip6_hop_by_hop.c b/vnet/vnet/ip/ip6_hop_by_hop.c
index 5769d7c3e6d..72490b915e4 100644
--- a/vnet/vnet/ip/ip6_hop_by_hop.c
+++ b/vnet/vnet/ip/ip6_hop_by_hop.c
@@ -191,9 +191,6 @@ ip6_add_hop_by_hop_node_fn (vlib_main_t * vm,
b1 = vlib_get_buffer (vm, bi1);
/* $$$$$ Dual loop: process 2 x packets here $$$$$ */
- ASSERT (b0->current_data == 0);
- ASSERT (b1->current_data == 0);
-
ip0 = vlib_buffer_get_current (b0);
ip1 = vlib_buffer_get_current (b1);
@@ -533,9 +530,6 @@ ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm,
b1 = vlib_get_buffer (vm, bi1);
/* $$$$$ Dual loop: process 2 x packets here $$$$$ */
- ASSERT (b0->current_data == 0);
- ASSERT (b1->current_data == 0);
-
ip0 = vlib_buffer_get_current (b0);
ip1 = vlib_buffer_get_current (b1);
adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
@@ -990,134 +984,6 @@ VLIB_CLI_COMMAND (ip6_show_ioam_run_cmd, static) = {
};
/* *INDENT-ON* */
-int
-ip6_ioam_set_destination (ip6_address_t * addr, u32 mask_width, u32 vrf_id,
- int is_add, int is_pop, int is_none)
-{
- ip6_main_t *im = &ip6_main;
- ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ip_lookup_main_t *lm = &im->lookup_main;
- ip_adjacency_t *adj;
- u32 fib_index;
- u32 adj_index;
-
- if ((is_add + is_pop + is_none) != 1)
- return VNET_API_ERROR_INVALID_VALUE_2;
-
- /* Go find the adjacency we're supposed to tickle */
- fib_index = ip6_fib_index_from_table_id (vrf_id);
-
- if (~0 == fib_index)
- return VNET_API_ERROR_NO_SUCH_FIB;
-
- adj_index = ip6_fib_table_fwding_lookup (im, fib_index, addr);
-
- ASSERT (!"Not an ADJ");
-
- /* Got it, modify as directed... */
- adj = ip_get_adjacency (lm, adj_index);
-
- /* Restore original lookup-next action */
- if (adj->saved_lookup_next_index)
- {
- adj->lookup_next_index = adj->saved_lookup_next_index;
- adj->saved_lookup_next_index = 0;
- }
-
- /* Save current action */
- if (is_add || is_pop)
- adj->saved_lookup_next_index = adj->lookup_next_index;
-
- if (is_add)
- adj->lookup_next_index =
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP;
-
- if (is_pop)
- adj->lookup_next_index =
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_POP_HOP_BY_HOP;
-
- hm->adj = *addr;
- hm->ioam_flag = (is_add ? IOAM_HBYH_ADD :
- (is_pop ? IOAM_HBYH_POP : IOAM_HBYH_MOD));
- return 0;
-}
-
-static clib_error_t *
-ip6_set_ioam_destination_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- ip6_address_t addr;
- u32 mask_width = ~0;
- int is_add = 0;
- int is_pop = 0;
- int is_none = 0;
- u32 vrf_id = 0;
- // int rv;
-
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "%U/%d", unformat_ip6_address, &addr, &mask_width))
- ;
- else if (unformat (input, "vrf-id %d", &vrf_id))
- ;
- else if (unformat (input, "add"))
- is_add = 1;
- else if (unformat (input, "pop"))
- is_pop = 1;
- else if (unformat (input, "none"))
- is_none = 1;
- else
- break;
- }
-
- if ((is_add + is_pop + is_none) != 1)
- return clib_error_return (0, "One of (add, pop, none) required");
- if (mask_width == ~0)
- return clib_error_return (0, "<address>/<mask-width> required");
-
- /* rv = ip6_ioam_set_destination (&addr, mask_width, vrf_id, */
- /* is_add, is_pop, is_none); */
-
- /* switch (rv) */
- /* { */
- /* case 0: */
- /* break; */
- /* default: */
- /* return clib_error_return (0, "ip6_ioam_set_destination returned %d", */
- /* rv); */
- /* } */
-
- /* return 0; */
-
- return clib_error_return (0,
- "ip6_ioam_set_destination Currnetly Disabled due to FIB2.0",
- 1);
-}
-
-/*?
- * This command sets the In-band OAM (iOAM) destination IPv6 address
- * subnet. An action is required (add, pop or none). Optionally, an IPv6
- * FIB table (aka VRF Table) can be provided. If not provided, table 0
- * used.
- *
- * Use '<em>show ioam summary</em>' to verify the configured settings.
- *
- * @todo This content needs to be validated and potentially more detail added.
- *
- * @cliexpar
- * Example of how to set the iOAM destination:
- * @cliexcmd{set ioam destination ff02::1/128 pop vrf-id 8}
-?*/
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (ip6_set_ioam_destination_cmd, static) = {
- .path = "set ioam destination",
- .short_help = "set ioam destination <ip6-address>/<width> {add|pop|none} [vrf-id <table-id>]",
- .function = ip6_set_ioam_destination_command_fn,
-};
-/* *INDENT-ON* */
-
-
void
vnet_register_ioam_end_of_path_callback (void *cb)
{