From ce0c46836cced6b2a0b6d908d21a926495d1405e Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 9 Nov 2018 12:56:18 +0100 Subject: [PATCH] gnrc_ipv6_nib: provide interface on packet queueing Without this the first packet to a new link-local address will not be delivered in non-6Lo environments, since the interface is not provided. With this change, if an internet was provided to the address resolver it will be stored within an allocated `gnrc_netif_hdr_t`. At this point [IPv6 already striped](netif strip) the packet of its netif header, so there is no risk that there will be to, in case it was provided and the `netif` came from its existence. --- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 0ae1915821..7240cd957f 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -1151,6 +1151,19 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_pktqueue_t *queue_entry = _alloc_queue_entry(pkt); if (queue_entry != NULL) { + if (netif != NULL) { + gnrc_pktsnip_t *netif_hdr = gnrc_netif_hdr_build( + NULL, 0, NULL, 0 + ); + if (netif_hdr == NULL) { + DEBUG("nib: can't allocate netif header for queue\n"); + gnrc_pktbuf_release(pkt); + queue_entry->pkt = NULL; + return false; + } + ((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = netif->pid; + LL_PREPEND(queue_entry->pkt, netif_hdr); + } gnrc_pktqueue_add(&entry->pktqueue, queue_entry); } }