mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 04:52:59 +01:00
tinydtls: sock_dtls: only use ifindex with link-local addresses
For global addresses the out-going interface is typically decided by the forwarding information base, so _requiring_ the user to set it with `sock_dtls` is undesirable. This has the caveat, that now on `sock_udp_send()` in the `_write()` method, the sock does not know via which network interface to send a packet with a global address, but again: this is really more a task for the underlying network stack, not the sock layer.
This commit is contained in:
parent
5e81bd56b0
commit
8f5561d694
@ -813,7 +813,13 @@ static void _ep_to_session(const sock_udp_ep_t *ep, session_t *session)
|
||||
session->port = ep->port;
|
||||
session->size = sizeof(ipv6_addr_t) + /* addr */
|
||||
sizeof(unsigned short); /* port */
|
||||
session->ifindex = ep->netif;
|
||||
if (ipv6_addr_is_link_local((ipv6_addr_t *)ep->addr.ipv6)) {
|
||||
/* set ifindex for link-local addresses */
|
||||
session->ifindex = ep->netif;
|
||||
}
|
||||
else {
|
||||
session->ifindex = SOCK_ADDR_ANY_NETIF;
|
||||
}
|
||||
memcpy(&session->addr, &ep->addr.ipv6, sizeof(ipv6_addr_t));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user