Zephyr Project
3.6.0

Contents

  • Introduction
  • Developing with Zephyr
  • Kernel
  • OS Services
  • Build and Configuration Systems
  • Connectivity
    • Bluetooth
    • Controller Area Network (CAN) Bus Protocols
    • Networking
      • Overview
      • Network Stack Architecture
      • Network Configuration Guide
      • Networking with the host system
      • Monitor Network Traffic
      • Networking APIs
        • Network APIs
        • Network Buffer Management
        • Networking Technologies
        • Protocols
        • Network System Management
        • Time Sensitive Networking
        • Generic GSM Modem
        • zperf: Network Traffic Generator
      • Connection Manager
    • LoRa and LoRaWAN
    • USB
  • Hardware Support
  • Contributing to Zephyr
  • Project and Governance
  • Security
  • Safety
  • Samples and Demos
  • Supported Boards
  • Releases
Zephyr Project
  • Connectivity
  • Networking
  • Networking APIs
  • Network System Management
  • Link Layer Address Handling
  • View page source

Link Layer Address Handling

  • Overview

  • API Reference

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.

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

Public Members

uint8_t *addr

The array of byte representing the address.

uint8_t len

Length of that address array.

uint8_t type

What kind of address is this for.

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.

Public Members

uint8_t type

What kind of address is this for.

uint8_t len

The real length of the ll address.

uint8_t addr[6]

The array of bytes representing the address.

Next Previous

© Copyright 2015-2024 Zephyr Project members and individual contributors. Last updated on Aug 04, 2024.

Zephyr Project
Bridle
Bridle API
Zephyr Project API
Kconfig Reference
Devicetree Bindings