|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
26 #ifndef ETHER_ADDR_LEN
50 u8 ** mgmt_ip6,
u8 ** mgmt_oid,
int enable)
81 if (port_desc && *port_desc)
87 if (mgmt_ip4 && *mgmt_ip4)
93 if (mgmt_ip6 && *mgmt_ip6)
99 if (mgmt_oid && *mgmt_oid)
158 u8 *port_desc = NULL;
159 u8 *mgmt_ip4 = NULL, *mgmt_ip6 = NULL, *mgmt_oid = NULL;
161 ip6_address_t ip6_addr;
170 else if (
unformat (input,
"disable"))
172 else if (
unformat (input,
"port-desc %s", &port_desc))
186 else if (
unformat (input,
"mgmt-oid %s", &mgmt_oid))
196 &port_desc, &mgmt_ip4,
197 &mgmt_ip6, &mgmt_oid,
264 else if (
unformat (input,
"tx-hold %d", &hold_time))
270 "invalid tx-hold `%d' (out of range <%d,%d>)",
276 else if (
unformat (input,
"tx-interval %d", &tx_interval))
283 "invalid tx-interval `%d' (out of range <%d,%d>)",
303 .path =
"set interface lldp",
304 .short_help =
"set interface lldp <interface> | sw_if_index <idx>"
305 " [port-desc <string>] [mgmt-ip4 <string>]"
306 " [mgmt-ip6 <string>] [mgmt-oid <string>] [disable]",
312 .short_help =
"set lldp [system-name <string>] [tx-hold <value>] "
313 "[tx-interval <value>]",
323 #define F(num, val, str) \
329 return "unknown chassis subtype";
337 #define F(num, val, str) \
343 return "unknown port subtype";
358 const u8 *
id = va_arg (*va,
u8 *);
359 const unsigned len = va_arg (*va,
unsigned);
360 const int detail = va_arg (*va,
int);
385 if (ETHER_ADDR_LEN ==
len)
431 const u8 *
id = va_arg (*va,
u8 *);
432 const unsigned len = va_arg (*va,
unsigned);
433 const int detail = va_arg (*va,
int);
460 if (ETHER_ADDR_LEN ==
len)
505 return "unknown lldp tlv";
517 const lldp_tlv_t *tlv = va_arg (*va, lldp_tlv_t *);
527 ((lldp_chassis_id_tlv_t *) tlv)->subtype,
528 ((lldp_chassis_id_tlv_t *) tlv)->
id,
533 ((lldp_port_id_tlv_t *) tlv)->subtype,
534 ((lldp_port_id_tlv_t *) tlv)->
id,
555 f64 ago = va_arg (*va,
double);
556 f64 now = va_arg (*va,
double);
559 return format (s,
"never");
561 return format (s,
"%.1fs ago",
now - ago);
571 s =
format (s,
"LLDP configuration:\n");
580 s =
format (s,
"\nLLDP-enabled interface table:\n");
589 s =
format(s,
"\nLocal Interface name: %v\n"
590 "Local Port Description: %s\n",
594 s =
format (s,
"Local Management address: %U\n",
600 s =
format (s,
"Local Management address IPV6: %U\n",
606 s =
format (s,
"Local Management address OID: %U\n",
613 s =
format(s,
"Interface/peer state: interface down\n"
614 "Last packet sent: %U\n",
617 else if (now < n->last_heard + n->
ttl)
620 "Interface/peer state: active\n"
621 "Peer chassis ID: %U\nRemote port ID: %U\n"
622 "Last packet sent: %U\nLast packet received: %U\n",
632 "Interface/peer state: inactive(timeout)\n"
633 "Last known peer chassis ID: %U\n"
634 "Last known peer port ID: %U\nLast packet sent: %U\n"
635 "Last packet received: %U\n",
652 const int detail = va_arg (*va,
int);
662 s =
format (s,
"%-25s %-25s %-25s %=15s %=15s %=10s\n",
"Local interface",
663 "Peer chassis ID",
"Remote port ID",
"Last heard",
"Last sent",
676 if (now < n->last_heard + n->
ttl)
678 s =
format(s,
"%-25v %-25U %-25U %=15U %=15U %=10s\n", hw->
name,
687 s =
format(s,
"%-25v %-25s %-25s %=15U %=15U %=10s\n", hw->
name,
716 .short_help =
"show lldp [detail]",
733 const lldp_tlv_t *tlv;
738 tlv = (lldp_tlv_t *) cur;
static clib_error_t * lldp_intf_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 lldp_process_node_index
enum lldp_cfg_err lldp_cfg_err_t
#define clib_memcpy(d, s, n)
@ VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER
#define LLDP_MIN_TX_INTERVAL
vlib_main_t vlib_node_runtime_t * node
#define clib_error_return(e, args...)
#define LLDP_CHASS_ID_SUBTYPE_NAME(t)
static clib_error_t * show_lldp(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u8 * format_lldp_chassis_id(u8 *s, va_list *va)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
vnet_hw_interface_t * hw_interfaces
static const char * lldp_port_id_subtype_str(lldp_port_id_subtype_t t)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
#define LLDP_MAX_TX_INTERVAL
vnet_sw_interface_flags_t flags
u8 * format_mac_address(u8 *s, va_list *args)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
@ foreach_chassis_id_subtype
static clib_error_t * lldp_cfg_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_foreach(VAR, POOL)
Iterate through pool.
static clib_error_t * lldp_cfg_err_to_clib_err(lldp_cfg_err_t e)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
@ foreach_port_id_subtype
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static u8 * format_lldp_intfs_detail(u8 *s, vlib_main_t *vm, const lldp_main_t *lm)
u8 * format_lldp_port_id(u8 *s, va_list *va)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static vlib_cli_command_t set_interface_lldp_cmd
(constructor) VLIB_CLI_COMMAND (set_interface_lldp_cmd)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
const u8 lldp_mac_addr[6]
vl_api_mac_address_t mac_addr
static vlib_cli_command_t show_lldp_command
(constructor) VLIB_CLI_COMMAND (show_lldp_command)
static u8 * format_lldp_intfs(u8 *s, va_list *va)
description ARP replies copied to host
#define vec_free(V)
Free vector's memory (no header).
void lldp_delete_intf(lldp_main_t *lm, lldp_intf_t *n)
ethernet_main_t ethernet_main
lldp_cfg_err_t lldp_cfg_set(u8 **host, int hold_time, int tx_interval)
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
static const char * lldp_tlv_code_str(lldp_tlv_code_t t)
lldp_cfg_err_t lldp_cfg_intf_set(u32 hw_if_index, u8 **port_desc, u8 **mgmt_ip4, u8 **mgmt_ip6, u8 **mgmt_oid, int enable)
void lldp_schedule_intf(lldp_main_t *lm, lldp_intf_t *n)
u8 * lldp_input_format_trace(u8 *s, va_list *args)
#define LLDP_PORT_ID_SUBTYPE_NAME(t)
LLDP global declarations.
lldp_port_id_subtype_t port_id_subtype
clib_error_t * vnet_hw_interface_add_del_mac_address(vnet_main_t *vnm, u32 hw_if_index, const u8 *mac_address, u8 is_add)
static u8 * format_time_ago(u8 *s, va_list *va)
lldp_chassis_id_subtype_t chassis_id_subtype
#define clib_error_free(e)
lldp_chassis_id_subtype_t
LLDP external definition.
static f64 vlib_time_now(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index
u8 * format_lldp_tlv(u8 *s, va_list *va)
#define STRUCT_SIZE_OF(t, f)
static vlib_cli_command_t set_lldp_cmd
(constructor) VLIB_CLI_COMMAND (set_lldp_cmd)
vnet_interface_main_t interface_main
static const char * lldp_chassis_id_subtype_str(lldp_chassis_id_subtype_t t)