netif/internal.h

NETDEV_MSG_TYPE_EVENT

Message type for netdev.h::netdev_event_t.

1
(0x1234)
gnrc_netif_is_6lbr( netif)

Checks if the interface represents a 6Lo border router (6LBR) according to RFC 6775.

1
(false)

Note

Assumed to be false, when ipv6/nib/conf.h::GNRC_IPV6_NIB_CONF_6LBR == 0.

Parameters

netif:the network interface

Return values

  • true, if the interface represents a 6LBR
  • false, if the interface does not represent a 6LBR
void gnrc_netif_acquire(gnrc_netif_t * netif)

Acquires exclusive access to the interface.

Parameters

netif:the network interface

void gnrc_netif_release(gnrc_netif_t * netif)

Releases exclusive access to the interface.

Parameters

netif:the network interface

int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t * netif, const ipv6_addr_t * addr, unsigned pfx_len, uint8_t flags)

Adds an IPv6 address to the interface.

Parameters

netif:the network interface. Must not be NULL.
addr:the address to add. If the address is already on the interface the function will return 0, but flags will be ignored. Must not be NULL or be a link-local or multicast address.
pfx_len:length in bits of the prefix of addr
flags:initial flags for the address.
  • Setting the address’ state to gnrc/netif/ipv6.h::GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE means that this address is assumed to be added due to stateless auto-address configuration and actions related to that may be performed in the background.
  • Setting the address’ state to gnrc/netif/ipv6.h::GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID means that the address is assumed to be manually configured and its prefix will be added to the node’s prefix list (valid and preferred lifetime will be set to infinite, but can be changed using pl.h::gnrc_ipv6_nib_pl_set()).

Note

Only available with gnrc_ipv6.

Return values

  • >= 0, on success
  • -ENOMEM, when no space for new addresses (or its solicited nodes multicast address) is left on the interface
void gnrc_netif_ipv6_addr_remove_internal(gnrc_netif_t * netif, const ipv6_addr_t * addr)

Removes an IPv6 address from the interface.

Parameters

netif:the network interface
addr:the address to remove

Note

Only available with gnrc_ipv6.

int gnrc_netif_ipv6_addr_idx(gnrc_netif_t * netif, const ipv6_addr_t * addr)

Returns the index of addr in gnrc_netif_t::ipv6_addrs of netif.

Can be used to check if an address is assigned to an interface.

Parameters

netif:the network interface
addr:the address to check

Note

Only available with gnrc_ipv6.

Return values

  • index of addr in gnrc_netif_t::ipv6_addrs of netif
  • -1, if addr isn’t assigned to netif
uint8_t gnrc_netif_ipv6_addr_get_state(const gnrc_netif_t * netif, int idx)

Gets state from address flags.

Parameters

netif:the network interface
idx:index of the address flags

Return values

  • the state of the address at idx
uint8_t gnrc_netif_ipv6_addr_dad_trans(const gnrc_netif_t * netif, int idx)

Gets number of duplicate address detection transmissions already performed for an address.

Parameters

netif:the network interface
idx:index of the address (and its flags)

Return values

  • the number of duplicate address detection transmissions already performed
int gnrc_netif_ipv6_addr_match(gnrc_netif_t * netif, const ipv6_addr_t * addr)

Returns the index of an address in gnrc_netif_t::ipv6_addrs of netif that matches addr best.

Can be used to check if a prefix is assigned to an interface.

Parameters

netif:the network interface
addr:the prefix to match

Note

Only available with gnrc_ipv6.

Return values

  • index of an address in gnrc_netif_t::ipv6_addrs of netif that best matches addr.
  • -1, if no address on netif matches addr
ipv6_addr_t * gnrc_netif_ipv6_addr_best_src(gnrc_netif_t * netif, const ipv6_addr_t * dst, bool ll_only)

Searches for the best address on an interface usable as a source address for a given destination address.

Parameters

netif:the network interface
dst:the destination address you want to find a source for.
ll_only:only link local addresses qualify

See also

RFC 6724

Note

Only available with gnrc_ipv6.

Rule 4 from RFC 6724 is currently not implemented. Has to updated as soon as gnrc supports Mobile IP.

Rule 6 from RFC 6724 is currently not implemented. Has to updated as soon as gnrc supports flow labels.

Rule 7 from RFC 6724 is currently not implemented. Has to updated as soon as gnrc supports temporary addresses.

Return values

  • The best source address for a packet addressed to dst
  • NULL, if no matching address can be found on the interface.
gnrc_netif_t * gnrc_netif_get_by_ipv6_addr(const ipv6_addr_t * addr)

Gets an interface by an address (incl.

multicast groups) assigned to it.

Parameters

addr:an IPv6 address

Return values

  • The network interface that has addr assigned
  • NULL, if no interface has addr assigned
gnrc_netif_t * gnrc_netif_get_by_prefix(const ipv6_addr_t * prefix)

Gets an interface by an address matching a given prefix best.

Parameters

prefix:an IPv6 address or prefix

Return values

  • The network interface that has an address assigned, that matches prefix best
  • NULL, if there is no address on any interface that matches
int gnrc_netif_ipv6_group_join_internal(gnrc_netif_t * netif, const ipv6_addr_t * addr)

Joins interface to an IPv6 multicast group.

Parameters

netif:the network interface
addr:the address of the multicast group

Note

Only available with gnrc_ipv6.

Return values

  • 0, on success
  • -ENOMEM, when no space for new addresses is left on the interface
void gnrc_netif_ipv6_group_leave_internal(gnrc_netif_t * netif, const ipv6_addr_t * addr)

Let interface leave from an IPv6 multicast group.

Parameters

netif:the network interface
addr:the address of the multicast group

Note

Only available with gnrc_ipv6.

int gnrc_netif_ipv6_group_idx(gnrc_netif_t * netif, const ipv6_addr_t * addr)

Returns the index of addr in gnrc_netif_t::ipv6_groups of netif.

Can be used to check if a multicast address is assigned to an interface.

Parameters

netif:the network interface
addr:the multicast address to check

Note

Only available with gnrc_ipv6.

Return values

  • index of addr in gnrc_netif_t::ipv6_groups of netif
  • -1, if netif is not in group addr
int gnrc_netif_ipv6_get_iid(gnrc_netif_t * netif, eui64_t * eui64)

Gets interface identifier (IID) of an interface’s link-layer address.

Parameters

netif:the network interface
eui64:the IID

Return values

bool gnrc_netif_is_rtr(const gnrc_netif_t * netif)

Checks if the interface represents a router according to RFC 4861.

Note

Assumed to be false, when gnrc_ipv6_router module is not included.

Parameters

netif:the network interface

Return values

  • true, if the interface represents a router
  • false, if the interface does not represent a router
bool gnrc_netif_is_rtr_adv(const gnrc_netif_t * netif)

Checks if the interface is allowed to send out router advertisements.

Note

Assumed to be false, when gnrc_ipv6_router module is not included.

Parameters

netif:the network interface

Return values

  • true, if the interface is allowed to send out router advertisements
  • false, if the interface is not allowed to send out router advertisements
bool gnrc_netif_is_6ln(const gnrc_netif_t * netif)

Checks if the interface represents a 6Lo node (6LN) according to RFC 6775.

Note

Assumed to be true, when netif/conf.h::GNRC_NETIF_NUMOF == 1 and 6LoWPAN module is included (and ipv6/nib/conf.h::GNRC_IPV6_NIB_CONF_6LN is not 0, otherwise assumed to be false).

Parameters

netif:the network interface

Return values

  • true, if the interface represents a 6LN
  • false, if the interface does not represent a 6LN
bool gnrc_netif_is_6lr(const gnrc_netif_t * netif)

Checks if the interface represents a 6Lo router (6LR) according to RFC 6775.

Note

Assumed to be false, when ipv6/nib/conf.h::GNRC_IPV6_NIB_CONF_6LR == 0

Parameters

netif:the network interface

Return values

  • true, if the interface represents a 6LR
  • false, if the interface does not represent a 6LR