if [ ${FIX} == 0 ]; then
indent ${i} -o ${i}.out1 > /dev/null 2>&1
indent ${i}.out1 -o ${i}.out2 > /dev/null 2>&1
+ # Remove trailing whitespace
+ sed -i -e 's/[[:space:]]*$//' ${i}.out2
diff -q ${i} ${i}.out2
else
indent ${i}
indent ${i}
+ # Remove trailing whitespace
+ sed -i -e 's/[[:space:]]*$//' ${i}
fi
if [ $? != 0 ]; then
EXIT_CODE=1
/** Suspend a cooperative multi-tasking thread
Waits for an event, or for the indicated number of seconds to elapse
@param vm - vlib_main_t pointer
- @param dt - timeout, in seconds.
+ @param dt - timeout, in seconds.
@returns the remaining time interval
*/
#define EXAMPLE_POLL_PERIOD 10.0
static uword
- example_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
+ example_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
vlib_frame_t * f)
{
f64 poll_time_remaining;
{
int i;
- // Sleep until next periodic call due,
- // or until we receive event(s)
+ // Sleep until next periodic call due,
+ // or until we receive event(s)
//
poll_time_remaining =
vlib_process_wait_for_event_or_clock (vm, poll_time_remaining);
handle_event2 (vm, event_data[i]);
break;
- // ... and so forth for each event type
+ // ... and so forth for each event type
default:
- // This should never happen...
- clib_warning ("BUG: unhandled event type %d",
+ // This should never happen...
+ clib_warning ("BUG: unhandled event type %d",
event_type);
break;
}
vec_reset_length (event_data);
- // Timer expired, call periodic function
+ // Timer expired, call periodic function
if (vlib_process_suspend_time_is_zero (poll_time_remaining))
{
example_periodic (vm);
poll_time_remaining = EXAMPLE_POLL_PERIOD;
}
}
- // NOTREACHED
+ // NOTREACHED
return 0;
- }
+ }
static VLIB_REGISTER_NODE (example_node) = {
.function = example_process,
n = pool_elt_at_index (cm->neighbors, p[0]);
}
- /*
+ /*
* typical clib idiom. Don't repeatedly allocate and free
- * the per-neighbor rx buffer. Reset its apparent length to zero
+ * the per-neighbor rx buffer. Reset its apparent length to zero
* and reuse it.
*/
if (n->disabled)
return CDP_ERROR_DISABLED;
- /*
+ /*
* Make sure the per-neighbor rx buffer is big enough to hold
* the data we're about to copy
*/
vec_validate (n->last_rx_pkt, vlib_buffer_length_in_chain (vm, b0) - 1);
- /*
+ /*
* Coalesce / copy e the buffer chain into the per-neighbor
- * rx buffer
+ * rx buffer
*/
nbytes = vlib_buffer_contents (vm, bi0, n->last_rx_pkt);
ASSERT (nbytes <= vec_len (n->last_rx_pkt));
- /*
+ /*
* Compute Jenkins hash of the new packet, decide if we need to
* actually parse through the TLV's. CDP packets are all identical,
* so unless we time out the peer, we don't need to process the packet.
pool_foreach (n, cm->neighbors,
({
hw = vnet_get_sup_hw_interface (vnm, n->sw_if_index);
-
+
if (n->disabled == 0)
- s = format (s, "%=25s %=15s %=25s %=10.1f\n",
+ s = format (s, "%=25s %=15s %=25s %=10.1f\n",
hw->name, n->device_name, n->port_id,
n->last_heard);
}));
/*
* packet counter strings
- * Dump these counters via the "show error" CLI command
+ * Dump these counters via the "show error" CLI command
*/
static char *cdp_error_strings[] = {
#define _(sym,string) string,
} cdp_next_t;
/*
- * Process a frame of cdp packets
- * Expect 1 packet / frame
+ * Process a frame of cdp packets
+ * Expect 1 packet / frame
*/
static uword
cdp_node_fn (vlib_main_t * vm,
}
/*
- * cdp input graph node declaration
+ * cdp input graph node declaration
*/
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (cdp_input_node, static) = {
.name = "cdp-input",
.vector_size = sizeof (u32),
.type = VLIB_NODE_TYPE_INTERNAL,
-
+
.n_errors = CDP_N_ERROR,
.error_strings = cdp_error_strings,
-
+
.format_trace = cdp_input_format_trace,
-
+
.n_next_nodes = CDP_INPUT_N_NEXT,
.next_nodes = {
[CDP_INPUT_NEXT_NORMAL] = "error-drop",
/* *INDENT-ON* */
/*
- * cdp periodic function
+ * cdp periodic function
*/
static uword
cdp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
}
/*
- * cdp periodic node declaration
+ * cdp periodic node declaration
*/
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (cdp_process_node, static) = {
for (i = 0; i < count; i++)
{
- /*
+ /*
* see cdp_periodic_init() to understand what's already painted
- * into the buffer by the packet template mechanism
+ * into the buffer by the packet template mechanism
*/
h0 = vlib_packet_template_get_packet
(vm, &cm->packet_templates[n->packet_template_index], &bi0);
for (i = 0; i < count; i++)
{
- /*
+ /*
* see cdp_periodic_init() to understand what's already painted
- * into the buffer by the packet template mechanism
+ * into the buffer by the packet template mechanism
*/
h0 = vlib_packet_template_get_packet
(vm, &cm->packet_templates[n->packet_template_index], &bi0);
for (i = 0; i < count; i++)
{
- /*
+ /*
* see cdp_periodic_init() to understand what's already painted
- * into the buffer by the packet template mechanism
+ * into the buffer by the packet template mechanism
*/
h0 = vlib_packet_template_get_packet
(vm, &cm->packet_templates[n->packet_template_index], &bi0);
static cdp_neighbor_t **n_list = 0;
/* *INDENT-OFF* */
- pool_foreach (n, cm->neighbors,
+ pool_foreach (n, cm->neighbors,
({
vec_add1 (n_list, n);
}));
}) cdp_tlv_t;
/*
- * TLV codes.
+ * TLV codes.
*/
#define foreach_cdp_tlv_type \
_(unused) \
| Address length | Address (variable) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- PT: Protocol type
- 1 = NLPID format
+ PT: Protocol type
+ 1 = NLPID format
2 = 802.2 format
- PT Length:
+ PT Length:
Length of protocol field, 1 for PT = 1, and either 3 or 8 for
802.2 format depending if SNAP is used for PT = 2.
field: <SSAP><DSAP><CTRL><-------OUI------><protocl_TYPE>
| | | | | | | | |
bytes: 0 1 2 3 4 5 6 7 8
-
+
where the first 3 bytes are 0xAAAA03 for SNAP encoded addresses.
The OUI is 000000 for ethernet and <protocl_TYPE>
is the assigned Ethernet type code for the particular protocol.
- e.g. for DECnet the encoding is AAAA03 000000 6003.
+ e.g. for DECnet the encoding is AAAA03 000000 6003.
for IPv6 the encoding is AAAA03 000000 86DD
*/
if (fp)
rv = (*fp) (mc->data, a->ethernet, sw_if_index, 0);
- /*
+ /*
* Signal the resolver process, as long as the user
* says they want to be notified
*/
proxy_src.as_u32 =
arp0->ip4_over_ethernet[1].ip4.data_u32;
- /*
+ /*
* Rewind buffer, direct code above not to
- * think too hard about it.
+ * think too hard about it.
* $$$ is the answer ever anything other than
* vlib_buffer_reset(..)?
*/
memset (&args, 0, sizeof (args));
- /*
+ /*
* Make sure that the route actually exists before we try to delete it,
* and make sure that it's a rewrite adjacency.
*
- * If we point 1-N unnumbered interfaces at a loopback interface and
- * shut down the loopback before shutting down 1-N unnumbered
- * interfaces, the ARP cache will still have an entry,
+ * If we point 1-N unnumbered interfaces at a loopback interface and
+ * shut down the loopback before shutting down 1-N unnumbered
+ * interfaces, the ARP cache will still have an entry,
* but the route will have disappeared.
- *
- * See also ip4_del_interface_routes (...)
+ *
+ * See also ip4_del_interface_routes (...)
* -> ip4_delete_matching_routes (...).
*/
if (adj_index != lm->miss_adj_index)
{
adj = ip_get_adjacency (lm, adj_index);
- /*
+ /*
* Stupid control-plane trick:
* admin down an interface (removes arp routes from fib),
* bring the interface back up (does not reinstall them)
}
/*
- * Remove any proxy arp entries asdociated with the
+ * Remove any proxy arp entries asdociated with the
* specificed fib.
*/
int
macp0 = (u8 *) hash_get (last_bd_config->mac_by_ip4, ip0);
if (PREDICT_FALSE (!macp0))
- goto next_l2_feature; // MAC not found
+ goto next_l2_feature; // MAC not found
// MAC found, send ARP reply -
// Convert ARP request packet to ARP reply
clib_memcpy (eth0->src_address, macp0, 6);
n_replies_sent += 1;
- // For BVI, need to use l2-fwd node to send ARP reply as
+ // For BVI, need to use l2-fwd node to send ARP reply as
// l2-output node cannot output packet to BVI properly
cfg0 = vec_elt_at_index (l2im->configs, sw_if_index0);
if (PREDICT_FALSE (cfg0->bvi))
clib_error_t *
arp_term_init (vlib_main_t * vm)
-{ // Initialize the feature next-node indexes
+{ // Initialize the feature next-node indexes
feat_bitmap_init_next_nodes (vm,
arp_term_l2bd_node.index,
L2INPUT_N_FEAT,
// Each comparison is checking both the valid flag and the number of tags
// (incorporating exact-match/non-exact-match).
- // check for specific double tag
+ // check for specific double tag
subint = &qinq_intf->subint;
if ((subint->flags & match_flags) == match_flags)
goto matched;
if ((subint->flags & match_flags) == match_flags)
goto matched;
- // check for specific single tag
+ // check for specific single tag
subint = &vlan_intf->single_tag_subint;
if ((subint->flags & match_flags) == match_flags)
goto matched;
if ((subint->flags & match_flags) == match_flags)
goto matched;
- // check for default interface
+ // check for default interface
subint = &main_intf->default_subint;
if ((subint->flags & match_flags) == match_flags)
goto matched;
ethernet_main_t *em = ðernet_main;
clib_error_t *error;
- /*
+ /*
* Set up the L2 path now, or we'll wipe out the L2 ARP
* registration set up by ethernet_arp_init.
*/
vlib_buffer_t *b;
// check tx node index, it is ethernet-input on loopback create
- // but can be changed to l2-input if loopback is configured as
+ // but can be changed to l2-input if loopback is configured as
// BVI of a BD (Bridge Domain).
loop_node = vec_elt (nm->nodes, node->node_index);
next_node_index = loop_node->next_nodes[next_index];
while (1)
{
// Set up RX and TX indices as if received from a real driver
- // unless loopback is used as a BVI. For BVI case, leave TX index
+ // unless loopback is used as a BVI. For BVI case, leave TX index
// and update l2_len in packet as required for l2 forwarding path
vnet_buffer (b)->sw_if_index[VLIB_RX] = sw_if_index;
if (bvi_flag)
#undef _
};
-/*
+/*
* To drop a pkt and increment one of the previous counters:
- *
+ *
* set b0->error = error_node->errors[RANDOM_ERROR_SAMPLE];
* set next0 to a disposition index bound to "error-drop".
*
* u32 node_counter_base_index = n->error_heap_index;
* vlib_error_main_t * em = &vm->error_main;
* em->counters[node_counter_base_index + MAC_SWAP_ERROR_SAMPLE] += 1;
- *
+ *
*/
typedef enum
.vector_size = sizeof (u32),
.format_trace = format_swap_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
-
+
.n_errors = ARRAY_LEN(mac_swap_error_strings),
.error_strings = mac_swap_error_strings,
SPARSE_VEC_INVALID_INDEX ? ETHERNET_ERROR_UNKNOWN_TYPE : *error0;
// The table is not populated with LLC values, so check that now.
- // If variant is variant_ethernet then we came from LLC processing. Don't
+ // If variant is variant_ethernet then we came from LLC processing. Don't
// go back there; drop instead using by keeping the drop/bad table result.
if ((type0 < 0x600) && (variant == ETHERNET_INPUT_VARIANT_ETHERNET))
{
// prior to calling this function. Thus only subinterface counters
// are incremented here.
//
- // Interface level counters include packets received on the main
+ // Interface level counters include packets received on the main
// interface and all subinterfaces. Subinterface level counters
// include only those packets received on that subinterface
// Increment stats if the subint is valid and it is not the main intf
stats_n_bytes += len0;
// Batch stat increments from the same subinterface so counters
- // don't need to be incremented for every packet.
+ // don't need to be incremented for every packet.
if (PREDICT_FALSE (new_sw_if_index0 != stats_sw_if_index))
{
stats_n_packets -= 1;
// not implemented yet or not ethernet
if (unsupported)
{
- // this is the NYI case
+ // this is the NYI case
error = clib_error_return (0, "not implemented yet");
}
goto done;
l3_next->sparse_index_by_input_next_index[ETHERNET_INPUT_NEXT_PUNT] =
SPARSE_VEC_INVALID_INDEX;
- /*
- * Make sure we don't wipe out an ethernet registration by mistake
+ /*
+ * Make sure we don't wipe out an ethernet registration by mistake
* Can happen if init function ordering constraints are missing.
*/
if (CLIB_DEBUG > 0)
em->l2_next =
vlib_node_add_next (vm, ethernet_input_node.index, node_index);
- /*
+ /*
* Even if we never use these arcs, we have to align the next indices...
*/
i = vlib_node_add_next (vm, ethernet_input_type_node.index, node_index);
vlib_cli_output(vm, " iip %U ispi %lx rip %U rspi %lx",
format_ip4_address, &sa->iaddr, sa->ispi,
format_ip4_address, &sa->raddr, sa->rspi);
-
+
tr = ikev2_sa_get_td_for_type(sa->r_proposals, IKEV2_TRANSFORM_TYPE_ENCR);
s = format(s, "%U ", format_ikev2_sa_transform, tr);
-
+
tr = ikev2_sa_get_td_for_type(sa->r_proposals, IKEV2_TRANSFORM_TYPE_PRF);
s = format(s, "%U ", format_ikev2_sa_transform, tr);
-
+
tr = ikev2_sa_get_td_for_type(sa->r_proposals, IKEV2_TRANSFORM_TYPE_INTEG);
s = format(s, "%U ", format_ikev2_sa_transform, tr);
-
+
tr = ikev2_sa_get_td_for_type(sa->r_proposals, IKEV2_TRANSFORM_TYPE_DH);
s = format(s, "%U ", format_ikev2_sa_transform, tr);
-
+
vlib_cli_output(vm, " %v", s);
vec_free(s);
-
+
vlib_cli_output(vm, " nonce i:%U\n r:%U",
format_hex_bytes, sa->i_nonce, vec_len(sa->i_nonce),
format_hex_bytes, sa->r_nonce, vec_len(sa->r_nonce));
-
+
vlib_cli_output(vm, " SK_d %U",
format_hex_bytes, sa->sk_d, vec_len(sa->sk_d));
vlib_cli_output(vm, " SK_a i:%U\n r:%U",
vlib_cli_output(vm, " SK_p i:%U\n r:%U",
format_hex_bytes, sa->sk_pi, vec_len(sa->sk_pi),
format_hex_bytes, sa->sk_pr, vec_len(sa->sk_pr));
-
+
vlib_cli_output(vm, " identifier (i) %U",
format_ikev2_id_type_and_data, &sa->i_id);
vlib_cli_output(vm, " identifier (r) %U",
format_ikev2_id_type_and_data, &sa->r_id);
-
+
vec_foreach(child, sa->childs)
{
vlib_cli_output(vm, " child sa %u:", child - sa->childs);
-
+
tr = ikev2_sa_get_td_for_type(child->r_proposals, IKEV2_TRANSFORM_TYPE_ENCR);
s = format(s, "%U ", format_ikev2_sa_transform, tr);
-
+
tr = ikev2_sa_get_td_for_type(child->r_proposals, IKEV2_TRANSFORM_TYPE_INTEG);
s = format(s, "%U ", format_ikev2_sa_transform, tr);
-
+
tr = ikev2_sa_get_td_for_type(child->r_proposals, IKEV2_TRANSFORM_TYPE_ESN);
s = format(s, "%U ", format_ikev2_sa_transform, tr);
-
+
vlib_cli_output(vm, " %v", s);
vec_free(s);
-
+
vlib_cli_output(vm, " spi(i) %lx spi(r) %lx",
child->i_proposals ? child->i_proposals[0].spi : 0,
child->r_proposals ? child->r_proposals[0].spi : 0);
-
+
vlib_cli_output(vm, " SK_e i:%U\n r:%U",
format_hex_bytes, child->sk_ei, vec_len(child->sk_ei),
format_hex_bytes, child->sk_er, vec_len(child->sk_er));
u32 i, j;
/* *INDENT-OFF* */
pool_foreach_index(i, spd->policies, ({
- vp = pool_elt_at_index(spd->policies, i);
+ vp = pool_elt_at_index(spd->policies, i);
if (vp->priority != policy->priority)
continue;
if (vp->is_outbound != policy->is_outbound)
vec_del1 (spd->ipv4_outbound_policies, j);
break;
}
- }
+ }
}
else
{
vlib_cli_output (vm, "L2tp session lookup on %s", keystr);
/* *INDENT-OFF* */
- pool_foreach (session, lm->sessions,
+ pool_foreach (session, lm->sessions,
({
vlib_cli_output (vm, "%U", format_l2t_session, session);
}));
u32 cpu_index = os_get_cpu_number ();
/* *INDENT-OFF* */
- pool_foreach (session, lm->sessions,
+ pool_foreach (session, lm->sessions,
({
session_index = session - lm->sessions;
- counter_index =
- session_index_to_counter_index (session_index,
+ counter_index =
+ session_index_to_counter_index (session_index,
SESSION_COUNTER_USER_TO_NETWORK);
vlib_increment_combined_counter (&lm->counter_main,
- cpu_index,
- counter_index,
+ cpu_index,
+ counter_index,
1/*pkt*/, 1111 /*bytes*/);
vlib_increment_combined_counter (&lm->counter_main,
- cpu_index,
- counter_index+1,
+ cpu_index,
+ counter_index+1,
1/*pkt*/, 2222 /*bytes*/);
nincr++;
-
+
}));
/* *INDENT-ON* */
vlib_cli_output (vm, "Incremented %d active counters\n", nincr);
u32 nincr = 0;
/* *INDENT-OFF* */
- pool_foreach (session, lm->sessions,
+ pool_foreach (session, lm->sessions,
({
session_index = session - lm->sessions;
- counter_index =
- session_index_to_counter_index (session_index,
+ counter_index =
+ session_index_to_counter_index (session_index,
SESSION_COUNTER_USER_TO_NETWORK);
vlib_zero_combined_counter (&lm->counter_main, counter_index);
vlib_zero_combined_counter (&lm->counter_main, counter_index+1);
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (create_l2tpv3_tunnel_command, static) =
+VLIB_CLI_COMMAND (create_l2tpv3_tunnel_command, static) =
{
.path = "create l2tpv3 tunnel",
- .short_help =
+ .short_help =
"create l2tpv3 tunnel client <ip6> our <ip6> local-cookie <hex> remote-cookie <hex> local-session <dec> remote-session <dec>",
.function = create_l2tpv3_tunnel_command_fn,
};
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (set_l2tp_tunnel_cookie_command, static) =
+VLIB_CLI_COMMAND (set_l2tp_tunnel_cookie_command, static) =
{
.path = "set l2tpv3 tunnel cookie",
- .short_help =
+ .short_help =
"set l2tpv3 tunnel cookie <intfc> local <hex> remote <hex>",
.function = set_l2tp_tunnel_cookie_command_fn,
};
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (set_interface_ip6_l2tpv3, static) =
+VLIB_CLI_COMMAND (set_interface_ip6_l2tpv3, static) =
{
.path = "set interface ip6 l2tpv3",
.function = set_ip6_l2tpv3,
#ifndef __included_l2tp_packet_h__
#define __included_l2tp_packet_h__
-/*
+/*
* See RFC4719 for packet format.
* Note: the l2_specific_sublayer is present in current Linux l2tpv3
* tunnels. It is not present in IOS XR l2tpv3 tunnels.
/* *INDENT-OFF* */
typedef CLIB_PACKED (struct
{
- u32 session_id;
- u64 cookie; u32
+ u32 session_id;
+ u64 cookie; u32
l2_specific_sublayer; /* set to 0 (if present) */
}) l2tpv3_header_t;
/* *INDENT-ON* */
.vector_size = sizeof(u32),
.format_trace = format_map_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
-
+
.n_errors = MAP_N_ERROR,
.error_strings = map_error_strings,
.vector_size = sizeof(u32),
.format_trace = format_ip4_map_reass_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
-
+
.n_errors = MAP_N_ERROR,
.error_strings = map_error_strings,
/*
* In:
* IPv6 header (40)
- * ICMPv6 header (8)
+ * ICMPv6 header (8)
* IPv6 header (40)
* Original IPv4 header / packet
* Out:
/*
* This code supports the following MAP modes:
- *
+ *
* Algorithmic Shared IPv4 address (ea_bits_len > 0):
* ea_bits_len + ip4_prefix > 32
* psid_length > 0, ip6_prefix < 64, ip4_prefix <= 32
/* *INDENT-OFF* */
VLIB_CLI_COMMAND(map_traffic_class_command, static) = {
.path = "map params traffic-class",
- .short_help =
+ .short_help =
"traffic-class {0x0-0xff | copy}",
.function = map_traffic_class_command_fn,
};
/* *INDENT-OFF* */
VLIB_CLI_COMMAND(map_pre_resolve_command, static) = {
.path = "map params pre-resolve",
- .short_help =
+ .short_help =
"pre-resolve {ip4-nh <address>} | {ip6-nh <address>}",
.function = map_pre_resolve_command_fn,
};
/* *INDENT-OFF* */
VLIB_CLI_COMMAND(map_security_check_command, static) = {
.path = "map params security-check",
- .short_help =
+ .short_help =
"security-check on|off",
.function = map_security_check_command_fn,
};
/* *INDENT-OFF* */
VLIB_CLI_COMMAND(map_security_check_frag_command, static) = {
.path = "map params security-check fragments",
- .short_help =
+ .short_help =
"fragments on|off",
.function = map_security_check_frag_command_fn,
};
/* *INDENT-OFF* */
VLIB_CLI_COMMAND(map_add_domain_command, static) = {
.path = "map add domain",
- .short_help =
+ .short_help =
"map add domain ip4-pfx <ip4-pfx> ip6-pfx <ip6-pfx> ip6-src <ip6-pfx> "
"ea-bits-len <n> psid-offset <n> psid-len <n> [map-t] [mtu <mtu>]",
.function = map_add_domain_command_fn,
/* *INDENT-OFF* */
VLIB_CLI_COMMAND(map_add_rule_command, static) = {
.path = "map add rule",
- .short_help =
+ .short_help =
"map add rule index <domain> psid <psid> ip6-dst <ip6-addr>",
.function = map_add_rule_command_fn,
};
/* *INDENT-OFF* */
VLIB_CLI_COMMAND(map_del_command, static) = {
.path = "map del domain",
- .short_help =
+ .short_help =
"map del domain index <domain>",
.function = map_del_domain_command_fn,
};
s = format (s, "\n flags %U", format_ip6_sr_header_flags,
flags_host_byte_order, 0 /* bswap needed */ );
- /*
+ /*
* Header length is in 8-byte units (minus one), so
* divide by 2 to ascertain the number of ip6 addresses in the
* segment list
b0 = vlib_get_buffer (vm, bi0);
b1 = vlib_get_buffer (vm, bi1);
- /*
+ /*
* $$$ parse through header(s) to pick the point
* where we punch in the SR extention header
*/
ip0 = vlib_buffer_get_current (b0);
ip1 = vlib_buffer_get_current (b1);
- /*
+ /*
* SR-unaware service chaining case: pkt coming back from
* service has the original dst address, and will already
- * have an SR header. If so, send it to sr-local
+ * have an SR header. If so, send it to sr-local
*/
if (PREDICT_FALSE (ip0->protocol == IPPROTO_IPV6_ROUTE))
{
}
else
{
- /*
- * Copy data before the punch-in point left by the
- * required amount. Assume (for the moment) that only
+ /*
+ * Copy data before the punch-in point left by the
+ * required amount. Assume (for the moment) that only
* the main packet header needs to be copied.
*/
clib_memcpy (((u8 *) ip0) - vec_len (t0->rewrite),
next0 = sr_local_cb ? sr_local_cb (vm, node, b0, ip0, sr0) :
next0;
- /*
+ /*
* Ignore "do not rewrite" shtik in this path
*/
if (PREDICT_FALSE (next0 & 0x80000000))
next1 = sr_local_cb ? sr_local_cb (vm, node, b1, ip1, sr1) :
next1;
- /*
+ /*
* Ignore "do not rewrite" shtik in this path
*/
if (PREDICT_FALSE (next1 & 0x80000000))
b0 = vlib_get_buffer (vm, bi0);
- /*
+ /*
* $$$ parse through header(s) to pick the point
* where we punch in the SR extention header
*/
ip0 = vlib_buffer_get_current (b0);
- /*
+ /*
* SR-unaware service chaining case: pkt coming back from
* service has the original dst address, and will already
- * have an SR header. If so, send it to sr-local
+ * have an SR header. If so, send it to sr-local
*/
if (PREDICT_FALSE (ip0->protocol == IPPROTO_IPV6_ROUTE))
{
}
else
{
- /*
- * Copy data before the punch-in point left by the
- * required amount. Assume (for the moment) that only
+ /*
+ * Copy data before the punch-in point left by the
+ * required amount. Assume (for the moment) that only
* the main packet header needs to be copied.
*/
clib_memcpy (((u8 *) ip0) - vec_len (t0->rewrite),
next0 = sr_local_cb ? sr_local_cb (vm, node, b0, ip0, sr0) :
next0;
- /*
+ /*
* Ignore "do not rewrite" shtik in this path
*/
if (PREDICT_FALSE (next0 & 0x80000000))
/* The first specified hop goes right into the dst address */
clib_memcpy (&t->first_hop, &a->segments[0], sizeof (ip6_address_t));
- /*
+ /*
* Create the sr header rewrite string
* The list of segments needs an extra slot for the ultimate destination
* which is taken from the packet we add the SRH to.
ap = ip_add_adjacency (lm, &adj, 1 /* one adj */ ,
&adj_index);
- /*
+ /*
* Stick the tunnel index into the rewrite header.
- *
+ *
* Unfortunately, inserting an SR header according to the various
* RFC's requires parsing through the ip6 header, perhaps consing a
* buffer onto the head of the vlib_buffer_t, etc. We don't use the
* normal reverse bcopy rewrite code.
- *
+ *
* We don't handle ugly RFC-related cases yet, but I'm sure PL will complain
* at some point...
*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (sr_tunnel_command, static) = {
.path = "sr tunnel",
- .short_help =
+ .short_help =
"sr tunnel [del] [name <name>] src <addr> dst <addr> [next <addr>] "
"[clean] [reroute] [key <secret>] [policy <policy_name>]"
"[rx-fib-id <fib_id>] [tx-fib-id <fib_id>]",
if (!p) /* Either name parm not passed or no tunnel with that name found, show all */
{
/* *INDENT-OFF* */
- pool_foreach (t, sm->tunnels,
+ pool_foreach (t, sm->tunnels,
({
vec_add1 (tunnels, t);
}));
policy - sm->policies);
/* Yes, this could be construed as overkill but the last thing you should do is set
- the policy_index on the tunnel after everything is set in ip6_sr_main_t.
+ the policy_index on the tunnel after everything is set in ip6_sr_main_t.
If this is deemed overly cautious, could set this in the vec_len(tunnel_names) loop.
*/
for (i = 0; i < vec_len (policy->tunnel_indices); i++)
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (sr_policy_command, static) = {
.path = "sr policy",
- .short_help =
+ .short_help =
"sr policy [del] name <policy-name> tunnel <sr-tunnel-name> [tunnel <sr-tunnel-name>]*",
.function = sr_add_del_policy_command_fn,
};
if (!p) /* Either name parm not passed or no policy with that name found, show all */
{
/* *INDENT-OFF* */
- pool_foreach (policy, sm->policies,
+ pool_foreach (policy, sm->policies,
({
vec_add1 (policies, policy);
}));
pt = pool_elt_at_index (sm->policies, p[0]);
- /*
+ /*
Get the first tunnel associated with policy populate the fib adjacency.
From there, since this tunnel will have it's policy_index != ~0 it will
be the trigger in the dual_loop to pull up the policy and make a copy-rewrite
ap = ip_add_adjacency (lm, &adj, 1 /* one adj */ ,
&adj_index);
- /*
+ /*
* Stick the tunnel index into the rewrite header.
- *
+ *
* Unfortunately, inserting an SR header according to the various
* RFC's requires parsing through the ip6 header, perhaps consing a
* buffer onto the head of the vlib_buffer_t, etc. We don't use the
* normal reverse bcopy rewrite code.
- *
+ *
* We don't handle ugly RFC-related cases yet, but I'm sure PL will complain
* at some point...
*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (sr_multicast_map_command, static) = {
.path = "sr multicast-map",
- .short_help =
+ .short_help =
"sr multicast-map address <multicast-ip6-address> sr-policy <sr-policy-name> [del]",
.function = sr_add_del_multicast_map_command_fn,
};
({
if (!key)
vlib_cli_output (vm, "no multicast maps configured");
- else
+ else
{
multicast_address = *((ip6_address_t *)key);
pt = pool_elt_at_index (sm->policies, value);
if (pt)
{
- vlib_cli_output (vm, "address: %U policy: %s",
+ vlib_cli_output (vm, "address: %U policy: %s",
format_ip6_address, &multicast_address,
pt->name);
}
else
- vlib_cli_output (vm, "BUG: policy not found for address: %U with policy index %d",
+ vlib_cli_output (vm, "BUG: policy not found for address: %U with policy index %d",
format_ip6_address, &multicast_address,
value);
-
+
}
}));
}
else
{
- /*
+ /*
* We get here from sr_rewrite or sr_local, with
* sr->segments_left pointing at the (copy of the original) dst
* address. Use it, then increment sr0->segments_left.
goto do_trace0;
}
- /*
- * Rewrite the packet with the original dst address
- * We assume that the last segment (in processing order) contains
+ /*
+ * Rewrite the packet with the original dst address
+ * We assume that the last segment (in processing order) contains
* the original dst address. The list is reversed, so sr0->segments
* contains the original dst address.
*/
next0 = sr_local_cb ? sr_local_cb (vm, node, b0, ip0, sr0) : next0;
- /*
- * To suppress rewrite, return ~SR_LOCAL_NEXT_xxx
+ /*
+ * To suppress rewrite, return ~SR_LOCAL_NEXT_xxx
*/
if (PREDICT_FALSE (next0 & 0x80000000))
{
{
u64 *copy_dst0, *copy_src0;
u16 new_l0;
- /*
+ /*
* Copy the ip6 header right by the (real) length of the
* sr header. Here's another place which assumes that
* the sr header is the only extention header.
next1 = sr_local_cb ? sr_local_cb (vm, node, b1, ip1, sr1) : next1;
- /*
- * To suppress rewrite, return ~SR_LOCAL_NEXT_xxx
+ /*
+ * To suppress rewrite, return ~SR_LOCAL_NEXT_xxx
*/
if (PREDICT_FALSE (next1 & 0x80000000))
{
{
u64 *copy_dst1, *copy_src1;
u16 new_l1;
- /*
+ /*
* Copy the ip6 header right by the (real) length of the
* sr header. Here's another place which assumes that
* the sr header is the only extention header.
next0 = sr_local_cb ? sr_local_cb (vm, node, b0, ip0, sr0) : next0;
- /*
- * To suppress rewrite, return ~SR_LOCAL_NEXT_xxx
+ /*
+ * To suppress rewrite, return ~SR_LOCAL_NEXT_xxx
*/
if (PREDICT_FALSE (next0 & 0x80000000))
{
{
u64 *copy_dst0, *copy_src0;
u16 new_l0;
- /*
+ /*
* Copy the ip6 header right by the (real) length of the
* sr header. Here's another place which assumes that
* the sr header is the only extention header.
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_sr_hmac, static) = {
.path = "show sr hmac",
- .short_help = "show sr hmac",
+ .short_help = "show sr hmac",
.function = show_sr_hmac_fn,
};
/* *INDENT-ON* */
/* segment list, when inserting an ip6 SR header */
ip6_address_t *segments;
- /*
+ /*
* "Tag" list, aka segments inserted at the end of the list,
* past last_seg
*/
/* Protocol for next header. */
u8 protocol;
/*
- * Length of routing header in 8 octet units,
+ * Length of routing header in 8 octet units,
* not including the first 8 octets
*/
u8 length;
/* Next segment in the segment list */
u8 segments_left;
- /*
+ /*
* Policy list pointer: offset in the SRH of the policy
* list - in 16-octet units - not including the first 8 octets.
*/
hash_pair_t *p;
mheap_trace_t *q;
/* *INDENT-OFF* */
- hash_foreach_pair (p, tm->trace_by_callers,
+ hash_foreach_pair (p, tm->trace_by_callers,
({
q = uword_to_pointer (p->key, mheap_trace_t *);
ASSERT (q >= old_start && q < old_end);