54 s =
format (s,
"%d", label);
80 else if (
unformat (input,
"%d", label))
103 return (
format(s,
"[%U:%d:%d:%U]",
115 u8 ** result = va_arg (*args,
u8 **);
119 if (!
unformat (input,
"MPLS %d", &label))
122 label_exp_s_ttl = (label<<12) | (1<<8) | 0xFF;
128 u32 h_n_bytes =
sizeof (h[0]);
141 u32 * result = va_arg (*args,
u32 *);
144 if (!
unformat (input,
"MPLS: label %d", &label))
147 label = (label<<12) | (1<<8) | 0xFF ;
149 *result = clib_host_to_net_u32 (label);
158 s =
format (s,
"label %d exp %d, s %d, ttl %d",
191 return clib_net_to_host_u32(r1->
dest) - clib_net_to_host_u32(r2->
dest);
240 if (
unformat (line_input,
"table %d", &table_id))
242 else if (
unformat (line_input,
"del"))
244 else if (
unformat (line_input,
"add"))
246 else if (
unformat (line_input,
"eos"))
248 else if (
unformat (line_input,
"non-eos"))
250 else if (
unformat (line_input,
"%U/%d",
258 else if (
unformat (line_input,
"%U/%d",
266 else if (
unformat (line_input,
"via %U",
268 &rpath, &payload_proto))
273 else if (
unformat (line_input,
"%d", &local_label))
371 .path =
"mpls local-label",
373 .short_help =
"mpls local-label [add|del] <label-value> [eos|non-eos] via [next-hop-address] [next-hop-interface] [next-hop-table <value>] [weight <value>] [preference <value>] [udp-encap-id <value>] [ip4-lookup-in-table <value>] [ip6-lookup-in-table <value>] [mpls-lookup-in-table <value>] [resolve-via-host] [resolve-via-attached] [rx-ip4 <interface>] [out-labels <value value value>]",
395 if (
unformat (line_input,
"%d", &table_id))
397 else if (
unformat (line_input,
"del"))
399 else if (
unformat (line_input,
"add"))
401 else if (
unformat (line_input,
"name %s", &name))
440 .path =
"mpls table",
441 .short_help =
"mpls table [add|del] <table-id>",
fib_protocol_t fp_proto
protocol type
uword unformat_mpls_unicast_label(unformat_input_t *input, va_list *args)
A representation of a path as described by a route producer.
enum mpls_eos_bit_t_ mpls_eos_bit_t
uword unformat_fib_route_path(unformat_input_t *input, va_list *args)
Unformat a fib_route_path_t from CLI input.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static u32 vnet_mpls_uc_get_ttl(mpls_label_t label_exp_s_ttl)
fib_node_index_t fib_table_entry_path_add2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *rpaths)
Add n paths to an entry (aka route) in the FIB.
#define MPLS_IETF_IMPLICIT_NULL_LABEL
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define MPLS_IETF_ROUTER_ALERT_LABEL
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
u8 * format_mpls_unicast_label(u8 *s, va_list *args)
u8 * format_mpls_unicast_header_host_byte_order(u8 *s, va_list *args)
dpo_proto_t frp_proto
The protocol of the address below.
int mpls_dest_cmp(void *a1, void *a2)
u32 mpls_label_t
A label value only, i.e.
void fib_table_entry_local_label_remove(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
remove a MPLS local label for the prefix/route.
#define MPLS_IETF_IPV4_EXPLICIT_NULL_BRIEF_STRING
u8 * format_fib_protocol(u8 *s, va_list *ap)
#define clib_memcpy(d, s, n)
dpo_proto_t fp_payload_proto
This protocol determines the payload protocol of packets that will be forwarded by this entry once th...
#define MPLS_IETF_ROUTER_ALERT_STRING
#define VLIB_INIT_FUNCTION(x)
static u32 vnet_mpls_uc_get_s(mpls_label_t label_exp_s_ttl)
description fragment has unexpected format
Aggregate type for a prefix.
#define clib_error_return(e, args...)
static const char * mpls_eos_bit_names[]
#define MPLS_IETF_ROUTER_ALERT_BRIEF_STRING
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u16 fp_len
The mask length.
#define vlib_call_init_function(vm, x)
#define MPLS_IETF_IPV6_EXPLICIT_NULL_BRIEF_STRING
#define MPLS_IETF_GAL_STRING
void mpls_table_delete(u32 table_id, u8 is_api)
#define MPLS_IETF_ELI_LABEL
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
clib_error_t * vnet_mpls_table_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmdo)
uword unformat_mpls_header(unformat_input_t *input, va_list *args)
#define MPLS_IETF_IPV4_EXPLICIT_NULL_STRING
static u32 vnet_mpls_uc_get_label(mpls_label_t label_exp_s_ttl)
clib_error_t * ip_main_init(vlib_main_t *vm)
void fib_table_entry_path_remove2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_route_path_t *rpaths)
Remove n paths to an entry (aka route) in the FIB.
fib_node_index_t fib_table_entry_local_label_add(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
Add a MPLS local label for the prefix/route.
#define MPLS_LABEL_INVALID
#define MPLS_IETF_IPV4_EXPLICIT_NULL_LABEL
u32 fib_node_index_t
A typedef of a node index.
#define MPLS_IETF_IMPLICIT_NULL_BRIEF_STRING
u32 mpls_fib_index_from_table_id(u32 table_id)
#define VLIB_CLI_COMMAND(x,...)
#define MPLS_IETF_IPV6_EXPLICIT_NULL_STRING
static clib_error_t * vnet_mpls_local_label(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define MPLS_IETF_GAL_LABEL
void mpls_table_create(u32 table_id, u8 is_api, const u8 *name)
uword unformat_mpls_label_net_byte_order(unformat_input_t *input, va_list *args)
#define MPLS_IETF_ELI_STRING
#define MPLS_LABEL_POP
A value that is explicit about the end of the LSP.
#define MPLS_IETF_IMPLICIT_NULL_STRING
static clib_error_t * mpls_init(vlib_main_t *vm)
u8 * format_mpls_unicast_header_net_byte_order(u8 *s, va_list *args)
static u32 vnet_mpls_uc_get_exp(mpls_label_t label_exp_s_ttl)
#define FIB_NODE_INDEX_INVALID
#define MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL
u8 * format_mpls_eos_bit(u8 *s, va_list *args)
int mpls_label_cmp(void *a1, void *a2)
int mpls_fib_index_cmp(void *a1, void *a2)
u8 * format_mpls_header(u8 *s, va_list *args)