gnrc_ipv6: fix source check for loopback address
When the destination address is the loopback address (`::1`) in GNRC the selected network interface typically is `NULL`, as with GNRC no loopback interface de facto exists. So the assertion when checking if the source address is valid if `netif != NULL` fails on that check. This change fixes that issue by checking if the destination address is the loopback address, before checking the validity of the source address.
This commit is contained in:
parent
03b95ef833
commit
159accff37
@ -382,7 +382,8 @@ static int _fill_ipv6_hdr(gnrc_netif_t *netif, gnrc_pktsnip_t *ipv6)
|
||||
int idx;
|
||||
|
||||
gnrc_netif_acquire(netif);
|
||||
invalid_src = ((idx = gnrc_netif_ipv6_addr_idx(netif, &hdr->src)) >= 0) &&
|
||||
invalid_src = ((!ipv6_addr_is_loopback(&hdr->dst)) &&
|
||||
(idx = gnrc_netif_ipv6_addr_idx(netif, &hdr->src)) >= 0) &&
|
||||
(gnrc_netif_ipv6_addr_get_state(netif, idx) != GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID);
|
||||
gnrc_netif_release(netif);
|
||||
if (invalid_src) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user