|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
46 const u8 *chassis_id =
a->data;
47 const u8 *portid =
a->data +
a->chassis_id_len;
67 u8 chid_subtype,
const u8 * portid,
70 const size_t data_size =
88 return tlv->head.byte1 >> 1;
94 tlv->head.byte1 = (tlv->head.byte1 & 1) + (code << 1);
100 return (((
u16) (tlv->head.byte1 & 1)) << 8) + tlv->head.byte2;
106 tlv->head.byte2 =
length & ((1 << 8) - 1);
107 if (
length > (1 << 8) - 1)
109 tlv->head.byte1 |= 1;
113 tlv->head.byte1 &= (1 << 8) - 2;
122 const lldp_tlv_t *tlv = pkt;
124 #define TLV_VIOLATES_PKT_BOUNDARY(pkt, tlv) \
125 (((((u8 *)tlv) + sizeof (lldp_tlv_t)) > ((u8 *)pkt + vec_len (pkt))) || \
126 ((((u8 *)tlv) + lldp_tlv_get_length (tlv)) > ((u8 *)pkt + vec_len (pkt))))
132 return LLDP_ERROR_BAD_TLV;
141 return LLDP_ERROR_BAD_TLV;
144 u8 chid_subtype = ((lldp_chassis_id_tlv_t *) tlv)->subtype;
145 u8 *chid = ((lldp_chassis_id_tlv_t *) tlv)->id;
153 return LLDP_ERROR_BAD_TLV;
161 return LLDP_ERROR_BAD_TLV;
164 u8 portid_subtype = ((lldp_port_id_tlv_t *) tlv)->subtype;
165 u8 *portid = ((lldp_port_id_tlv_t *) tlv)->id;
173 return LLDP_ERROR_BAD_TLV;
178 return LLDP_ERROR_BAD_TLV;
187 #define F(num, type, str) \
188 case LLDP_TLV_NAME (type): \
194 return LLDP_ERROR_BAD_TLV;
204 return LLDP_ERROR_BAD_TLV;
207 portid_len, portid_subtype,
ttl);
208 return LLDP_ERROR_NONE;
264 return LLDP_ERROR_DISABLED;
#define LLDP_MIN_CHASS_ID_LEN
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
#define hash_set(h, key, value)
uword * intf_by_hw_if_index
#define clib_memcpy(d, s, n)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define vlib_call_init_function(vm, x)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
vnet_main_t * vnet_get_main(void)
static_always_inline uword vlib_get_thread_index(void)
static clib_error_t * lldp_template_init(vlib_main_t *vm)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define foreach_lldp_optional_tlv_type(F)
LLDP protocol declarations.
#define VLIB_INIT_FUNCTION(x)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
LLDP global declarations.
lldp_port_id_subtype_t port_id_subtype
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define LLDP_MAX_CHASS_ID_LEN
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define LLDP_MIN_PORT_ID_LEN
lldp_chassis_id_subtype_t chassis_id_subtype
static f64 vlib_time_now(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index
#define STRUCT_SIZE_OF(t, f)
VLIB buffer representation.
#define LLDP_MAX_PORT_ID_LEN