85 void *buf,
size_t len ) {
102 unsigned int tlv_type_len;
103 unsigned int tlv_type;
104 unsigned int tlv_len;
109 tag_type = ( tag_low >> 24 );
110 tag_index = ( tag_low >> 16 );
111 tag_offset = ( tag_low >> 8 );
112 tag_length = ( tag_low >> 0 );
115 match_len = tag_offset;
116 if ( match_len >
sizeof ( tag_prefix ) )
117 match_len =
sizeof ( tag_prefix );
118 if ( ! tag_prefix.high )
120 match = &tag_prefix.raw[
sizeof ( tag_prefix ) - match_len ];
123 for (
data = lldpset->
data, remaining = lldpset->
len ; remaining ;
124 data += tlv_len, remaining -= tlv_len ) {
127 if ( remaining <
sizeof ( *
tlv ) ) {
128 DBGC ( lldpset,
"LLDP %s underlength TLV header\n",
134 data +=
sizeof ( *tlv );
135 remaining -=
sizeof ( *tlv );
136 tlv_type_len =
ntohs (
tlv->type_len );
141 if ( remaining < tlv_len ) {
142 DBGC ( lldpset,
"LLDP %s underlength TLV value\n",
147 DBGC2 ( lldpset,
"LLDP %s found type %d:\n",
148 lldpset->
name, tlv_type );
152 if ( tlv_type != tag_type )
156 if ( tlv_len < match_len )
166 if ( tlv_len < tag_offset )
169 tlv_len -= tag_offset;
174 &setting_type_string );
178 if ( tag_length && ( tlv_len > tag_length ) )
179 tlv_len = tag_length;
206 const void *ll_dest,
const void *ll_source,
232 DBGC2 ( lldpset,
"LLDP %s src %s ",
233 lldpset->
name,
netdev->ll_protocol->ntoa ( ll_source ) );
234 DBGC2 ( lldpset,
"dst %s\n",
netdev->ll_protocol->ntoa ( ll_dest ) );
273 DBGC ( lldpset,
"LLDP %s could not register settings: %s\n",
277 DBGC ( lldpset,
"LLDP %s registered\n", lldpset->
name );
298 DBGC ( lldpset,
"LLDP %s unregistered\n", lldpset->
name );
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
#define assert(condition)
Assert a condition at run-time.
uint8_t data[48]
Additional event data.
static struct net_device * netdev
#define __unused
Declare a variable or data structure as unused.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define ENOENT
No such file or directory.
#define ENOMEM
Not enough space.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
static void settings_init(struct settings *settings, struct settings_operations *op, struct refcnt *refcnt, const struct settings_scope *default_scope)
Initialise a settings block.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static void lldp_remove(struct net_device *netdev __unused, void *priv)
Remove LLDP settings block.
static int lldp_probe(struct net_device *netdev, void *priv)
Create LLDP settings block.
static const struct settings_scope lldp_settings_scope
LLDP settings scope.
static struct settings_operations lldp_settings_operations
LLDP settings operations.
static int lldp_rx(struct io_buffer *iobuf, struct net_device *netdev, const void *ll_dest, const void *ll_source, unsigned int flags __unused)
Process LLDP packet.
static int lldp_fetch(struct settings *settings, struct setting *setting, void *buf, size_t len)
Fetch value of LLDP setting.
static int lldp_applies(struct settings *settings __unused, const struct setting *setting)
Check applicability of LLDP setting.
Link Layer Discovery Protocol.
#define LLDP_SETTINGS_NAME
LLDP settings block name.
#define LLDP_TLV_LEN(type_len)
Extract LLDP TLV length.
#define LLDP_TYPE_END
End of LLDP data unit.
#define LLDP_TLV_TYPE(type_len)
Extract LLDP TLV type.
void * malloc(size_t size)
Allocate memory.
uint32_t high
High 32 bits of address.
void * netdev_priv(struct net_device *netdev, struct net_driver *driver)
Get network device driver private data.
Network device management.
#define __net_driver
Declare a network driver.
#define __net_protocol
Declare a network-layer protocol.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
static void(* free)(struct refcnt *refcnt))
int register_settings(struct settings *settings, struct settings *parent, const char *name)
Register settings block.
void unregister_settings(struct settings *settings)
Unregister settings block.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
void * data
Start of data.
struct settings settings
Settings interface.
size_t len
Length of LLDP data.
A network upper-layer driver.
A network-layer protocol.
const struct settings_scope * scope
Setting scope (or NULL)
const struct setting_type * type
Setting type.
uint64_t tag
Setting tag, if applicable.
Settings block operations.
static struct tlan_private * priv