Using `container_of()` to translate from `netif_t *` to the containing
`gnrc_netif_t *` adds a bit of plausibility: It will fail when `gnrc_netif_t`
stops to contain `netif_t` as member. Additionally, this silences false
positives of -Wcast-align
This is required for Linux to accept the RIO
with this patch:
2001:db8:8000::/33 via fe80::d0e7:ffff:fe46:6b52 dev tap0 proto ra metric 1024 expires 86338sec pref medium
2001:db8::/32 dev tap0 proto kernel metric 256 pref medium
before:
2001:db8::/32 dev tap0 proto kernel metric 256 pref medium
A generic application might select netdev_default instead of
gnrc_netdev_default to pull in the default network interface.
So pull in gnrc_netif if netdev_default is selected with GNRC.
If we get a large (e.g. /62) prefix from e.g. DHCPv6, we can split it
into subnets automatically to configure downstream interfaces.
This allows for automatic configuration of daisy-chained nodes or
nodes connected in a tree topology.
To enable the feature, a new pseudo-module `gnrc_ipv6_auto_subnets` is
provided.
If the fib contains a route to a subnet via another host, it can not
be on-link.
Consider fib entries when deciding whether an address is on-link.
If a route via another host is a stronger match than an on-link
prefix, the address must be off-link.
Initialize addr with 0 first.
Otherwise if prefix is < 64 there will be random bits of stack memory
in the bits of the address that are neither touched by ipv6_addr_set_aiid()
nor ipv6_addr_init_prefix().
Sending a RA with ltime = 0 does not get us added to the default router
list, but the options (and therefore the RIO) are still parsed.
This even appears to work with Linux as a receiver.
When the default router was removed or could not be added, `dr` will
be NULL.
In this case, don't cease sending router solicitations - we still don't
have a default router.
dhcpv6_client_prefix_valid_until returned the valid timestamp
this fixes it according to the documentation given in
/sys/include/net/dhcpv6/client.h
to return seconds left
Consider the following: A node tries to forward a packet to another
host for which it does not know the route yet. It assumes it to be
on-link and starts a neighbor solicitation, putting the node address
in the destinatio cache.
Later the route is known (via a second hop) but the host is still in
the NIB.
The result is that gnrc_ipv6_nib_get_next_hop_l2addr() ends up in the
"nib: %s is in NC or on-link, start address resolution" case and does
not attempt to resolve the route.
This results in the host remaining unreachable even though now a route
is present.
Prefix delegation used to be the only supported feature of our DHCPv6
client, but by now it also supports MUD, DNS recursive name servers and
IA_NA is on the horizon. So it makes sense to make IA_PD an optional
module like all those other features are as well.
The `udp` command is a valuable debugging tool that is also useful
outside of the gnrc_networking example.
To enable easy sending of udp messages in other applications during
development, move the `udp` command to the shell module and introduce
the `gnrc_udp_cmd` pseudo-module to enable it.
This commit implements uplink redundancy in GNRC LoRaWAN. Uplink
redundancy is used to retransmit unconfirmed uplink frames. The
retransmission stops when either a downlink message is received or the
number of uplink retransmissions is reached.
This functionality doesn't affect confirmed uplinks.
If a node has two interfaces A with 2001:16b8:45b5:9af8:5884:3bff:fe4f:a903
and B with 2001:16b8:45b5:9afa:5884:3bff:fe4f:a902 and receives a neighbor
solicitation on A for an address configured on interface B, answer the neighbor
solicitation instead of bailing out with
> Target address 2001:16b8:45b5:9afa:5884:3bff:fe4f:a902 is not assigned
> to the local interface
Make gnrc_netif_create() block until the interface is created and
registered.
This avoids a race condition where after calling gnrc_netif_init_devs()
not all interfaces are available yet when iterating through the list
of interfaces with gnrc_netif_iter().
A lot of things break if `GNRC_NETIF_FLAGS_HAS_L2ADDR` is not set.
In order to handle router advertisements and auto-configureation,
generate a faux l2 address based on the netdev ID.
This option was unused before, honor it to make it possible to start
with router advertisements disabled and enable them at run time.
The defaults remain unchanged by that.
This commit removes the dependency to xtimer and RIOT messages.
This step is required to use other sources of events (e.g event_queue)
and timers (RTT)
If we switch the interface in gnrc_ipv6_nib_get_next_hop_l2addr()
we must also re-get the nib entry from the 'proper' interface.
Otherwise we will always find the host unreachable on the 'wrong'
interface.
Consider the following configuration:
nib prefix
2001:16b8:4569:88fc::/62 dev #7 expires 7081 sec deprecates 3481 sec
2001:16b8:4569:88fe::/63 dev #6
If `_on_link()` stops at the first match, a packet received from #7 with a
destination in the downstream subnet in #6 would always be sent back via #7
if this happens to be the first entry in the list.
Instead, consider all prefixes and return the one that is the closest match.
When two threads use `gnrc_ipv6_nib_get_next_hop_l2addr()` to determine
a next hop (e.g. when there is both an IPv6 sender and a 6LoWPAN
fragment forwarder), a race condition may happen, where one thread
acquires the NIB and the other acquires the network interface resulting
in a deadlock. By releasing the NIB (if acquired) before trying to
acquire the network interface and re-acquiring the NIB after the network
interface is acquired, this is fixed.
If we call `netif_register()` before we can be sure that the interface
can be configured, a 'zombie' interface remains in the list, causing
all kinds of trouble down the line.
Only call `netif_register()` if `init()` was successful.
In case of an error, the tx sync packet snip could previously have been
released twice. This moves re-attaching the tx sync snip down after the
last `goto error` to avoid this.
Otherwise the local mallocs variable is not decremented correctly (if
TEST_SUITES is defined) and the fuzzing setup (i.e. when MODULE_FUZZING
is defined) does not terminate. This regression was introduced in
3970b667aa.
The new `gnrc_tx_sync` module allows users of the GNRC network stack to
synchronize with the actual transmission of outgoing packets. This is directly
integrated into gnrc_sock. Hence, if `gnrc_tx_sync` is used, calls to e.g.
sock_udp_send() will block until the network stack has processed the message.
Use cases:
1. Prevent packet drop when sending at high rate
- If the application is sending faster than the stack can handle, the
message queues will overflow and outgoing packets are lost
2. Passing auxiliary data about the transmission back the stack
- When e.g. the number of required retransmissions, the transmission time
stamp, etc. should be made available to a user of an UDP sock, a
synchronization mechanism is needed
3. Simpler error reporting without footguns
- The current approach of using `core/msg` for passing up error messages is
difficult to use if other message come in. Currently, gnrc_sock is
busy-waiting and fetching messages from the message queue until the number
of expected status reports is received. It will enqueue all
non-status-report messages again at the end of the queue. This has
multiple issues:
- Busy waiting is especially in lower power scenarios with time slotted
MAC protocols harmful, as the CPU will remain active and consume
power even though the it could sleep until the TX slot is reached
- The status reports from the network stack are send to the user thread
blocking. If the message queue of the user thread is full, the network
stack would block until the user stack can fetch the messages. If
another higher priority thread would start sending a message, it
would busy wait for its status reports to completely come in. Hence,
the first thread doesn't get CPU time to fetch messages and unblock
the network stack. As a result, the system would lock up completely.
- Just adding the error/status code to the gnrc_tx_sync_t would preallocate
and reserve memory for the error reporting. That way gnrc_sock does not
need to search through the message queue for status reports and the
network stack does not need to block for the user thread fetching it.
Introduced a bool 'LORAMAC_DEFAULT_PRIVATE_NETWORK' to invert
the semantics of 'LORAMAC_DEFAULT_PUBLIC_NETWORK'. Move
'LORAMAC_DEFAULT_PRIVATE_NETWORK' to 'CONFIG_' namespace.
The driver uses the netdev interface. Due to the limited
capabilities of the transceiver (32 byte FIFO and no source address in the layer2 frame),
it relies on 6LowPAN compression and adds the source address to the frame for that.
The logic used to check whether the RX timestamp was provided in the GNRC
implementation of `sock_ip_recv_buf_aux()` is incorrect: It still uses in-band
signalling via a timestamp of zero, but a dedicated flag was added to allow for
timestamps of zero.
Additionally, it is not necessary to check if a bit is set only to clear it -
clearing it unconditionally is faster and smaller.