1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

ng_ipv6_nc: use new pktqueue

This commit is contained in:
Martine Lenders 2015-06-22 17:59:45 +02:00
parent 82e54d0970
commit 72b17d9620
2 changed files with 11 additions and 2 deletions

View File

@ -118,7 +118,7 @@ extern "C" {
* </a>.
*/
typedef struct {
ng_pktqueue_t pkts; /**< Packets waiting for address resolution */
ng_pktqueue_t *pkts; /**< Packets waiting for address resolution */
ng_ipv6_addr_t ipv6_addr; /**< IPv6 address of the neighbor */
uint8_t l2_addr[NG_IPV6_NC_L2_ADDR_MAX];/**< Link layer address of the neighbor */
uint8_t l2_addr_len; /**< Length of ng_ipv6_nc_t::l2_addr */

View File

@ -20,6 +20,7 @@
#include "net/ng_ipv6/nc.h"
#include "net/ng_ipv6/netif.h"
#include "net/ng_ndp.h"
#include "net/ng_pktbuf.h"
#include "thread.h"
#include "timex.h"
#include "vtimer.h"
@ -98,7 +99,7 @@ ng_ipv6_nc_t *ng_ipv6_nc_add(kernel_pid_t iface, const ng_ipv6_addr_t *ipv6_addr
/* Otherwise, fill free entry with your fresh information */
free_entry->iface = iface;
ng_pktqueue_init(&(free_entry->pkts));
free_entry->pkts = NULL;
memcpy(&(free_entry->ipv6_addr), ipv6_addr, sizeof(ng_ipv6_addr_t));
DEBUG("ipv6_nc: Register %s for interface %" PRIkernel_pid,
ng_ipv6_addr_to_str(addr_str, ipv6_addr, sizeof(addr_str)),
@ -133,6 +134,14 @@ void ng_ipv6_nc_remove(kernel_pid_t iface, const ng_ipv6_addr_t *ipv6_addr)
ng_ipv6_addr_to_str(addr_str, ipv6_addr, sizeof(addr_str)),
iface);
while (entry->pkts != NULL) {
#ifdef MODULE_NG_PKTBUF
ng_pktbuf_release(entry->pkts->pkt);
#endif
entry->pkts->pkt = NULL;
ng_pktqueue_remove_head(&entry->pkts);
}
ng_ipv6_addr_set_unspecified(&(entry->ipv6_addr));
entry->iface = KERNEL_PID_UNDEF;
entry->flags = 0;