Prefix list

Prefix list component of neighbor information base.

int gnrc_ipv6_nib_pl_set(unsigned iface, const ipv6_addr_t * pfx, unsigned pfx_len, uint32_t valid_ltime, uint32_t pref_ltime)

Adds (or updates) prefix to NIB.

Parameters

iface:Interface pfx is valid on.
pfx:The prefix. May not be a link-local prefix or a multicast address and its first pfx_len bits may not be 0. Must not be NULL.
pfx_len:Length of pfx in bits. Condition pfx_len > 0 must hold.
valid_ltime:Lifetime (in ms) until prefix expires from now. UINT32_MAX for infinite lifetime. Addresses with expired prefixes are removed from iface.
pref_ltime:Lifetime (in ms) until prefix deprecates from now. UINT32_MAX for infinite lifetime. Addresses with deprecated prefixes should not be used for new communication. Only applications with difficulty changing to another address without service disruption should use deprecated addresses. May not be greater then valid_ltime.

Return values

  • 0, on success.
  • -EINVAL, if pfx was fe80::` or multicast, pfx_len was == 0, the first pfx_len bits of @ pfx were 0, or if pref_ltime > valid_ltime.
  • -ENOMEM, if no space was left in the prefix list.
void gnrc_ipv6_nib_pl_del(unsigned iface, const ipv6_addr_t * pfx, unsigned pfx_len)

Deletes prefix from NIB.

Parameters

iface:The interface pfx is expected to be on (0 for any).
pfx:The prefix to be removed.
pfx_len:Length of pfx in bits.

bool gnrc_ipv6_nib_pl_iter(unsigned iface, void ** state, gnrc_ipv6_nib_pl_t * ple)

Iterates over all prefix list entries in the NIB.

Parameters

iface:Restrict iteration to entries on this interface. 0 for any interface.
state:Iteration state of the prefix list. Must point to NULL pointer to start iteration
ple:The next prefix list entry.
Usage example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include "net/gnrc/ipv6/nib/pl.h"

int main(void) {
    void *state = NULL;
    gnrc_ipv6_nib_pl_t ple;

    puts("My prefixes:");
    while (gnrc_ipv6_nib_pl_iter(0, &state, &ple)) {
        gnrc_ipv6_nib_pl_print(&ple);
    }
    return 0;
}

Note

The list may change during iteration.

Return values

  • true, if iteration can be continued.
  • false, if ple is the last prefix list ple in the NIB.
void gnrc_ipv6_nib_pl_print(gnrc_ipv6_nib_pl_t * ple)

Prints a prefix list entry.

Parameters

ple:A prefix list entry

struct gnrc_ipv6_nib_pl_t

Prefix list entry view on NIB.

ipv6_addr_t pfx

prefix

uint8_t pfx_len

length of pl.h::gnrc_ipv6_nib_pl_t::pfx in bits

uint16_t iface

interface pl.h::gnrc_ipv6_nib_pl_t::pfx is assigned to

uint32_t valid_until

timestamp (in ms) until which the prefix is valid

uint32_t pref_until

timestamp (in ms) until which the prefix is preferred