Link Layer Address Handling
Overview
The link layer addresses are set for network interfaces so that L2 connectivity works correctly in the network stack. Typically the link layer addresses are 6 bytes long like in Ethernet but for IEEE 802.15.4 the link layer address length is 8 bytes.
API Reference
- group net_linkaddr
Network link address library.
Defines
-
NET_LINK_ADDR_MAX_LENGTH
Maximum length of the link address
Enums
-
enum net_link_type
Type of the link address. This indicates the network technology that this address is used in. Note that in order to save space we store the value into a uint8_t variable, so please do not introduce any values > 255 in this enum.
Values:
-
enumerator NET_LINK_UNKNOWN = 0
Unknown link address type.
-
enumerator NET_LINK_IEEE802154
IEEE 802.15.4 link address.
-
enumerator NET_LINK_BLUETOOTH
Bluetooth IPSP link address.
-
enumerator NET_LINK_ETHERNET
Ethernet link address.
-
enumerator NET_LINK_DUMMY
Dummy link address. Used in testing apps and loopback support.
-
enumerator NET_LINK_CANBUS_RAW
CANBUS link address.
-
enumerator NET_LINK_CANBUS
6loCAN link address.
-
enumerator NET_LINK_UNKNOWN = 0
Functions
-
static inline bool net_linkaddr_cmp(struct net_linkaddr *lladdr1, struct net_linkaddr *lladdr2)
Compare two link layer addresses.
- Parameters
lladdr1 – Pointer to a link layer address
lladdr2 – Pointer to a link layer address
- Returns
True if the addresses are the same, false otherwise.
-
static inline int net_linkaddr_set(struct net_linkaddr_storage *lladdr_store, uint8_t *new_addr, uint8_t new_len)
Set the member data of a link layer address storage structure.
- Parameters
lladdr_store – The link address storage structure to change.
new_addr – Array of bytes containing the link address.
new_len – Length of the link address array. This value should always be <= NET_LINK_ADDR_MAX_LENGTH.
-
struct net_linkaddr
- #include <net_linkaddr.h>
Hardware link address structure.
Used to hold the link address information
-
struct net_linkaddr_storage
- #include <net_linkaddr.h>
Hardware link address structure.
Used to hold the link address information. This variant is needed when we have to store the link layer address.
Note that you cannot cast this to net_linkaddr as uint8_t * is handled differently than uint8_t addr[] and the fields are purposely in different order.
-
NET_LINK_ADDR_MAX_LENGTH