1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

gnrc_netif: fix GNRC_NETAPI_GET of arrays

The target array currently moves with the loop instead of with the
results. This fixes that.
This commit is contained in:
Martine Lenders 2017-11-20 14:18:09 +01:00
parent 460d3c44fe
commit 10b74740eb
No known key found for this signature in database
GPG Key ID: 8E97A9FE55F25D62

View File

@ -133,10 +133,11 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
res = 0;
for (unsigned i = 0;
(res < opt->data_len) && (i < GNRC_NETIF_IPV6_ADDRS_NUMOF);
i++, tgt++) {
i++) {
if (netif->ipv6.addrs_flags[i] != 0) {
memcpy(tgt, &netif->ipv6.addrs[i], sizeof(ipv6_addr_t));
res += sizeof(ipv6_addr_t);
tgt++;
}
}
}
@ -148,10 +149,11 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
res = 0;
for (unsigned i = 0;
(res < opt->data_len) && (i < GNRC_NETIF_IPV6_ADDRS_NUMOF);
i++, tgt++) {
i++) {
if (netif->ipv6.addrs_flags[i] != 0) {
*tgt = netif->ipv6.addrs_flags[i];
res += sizeof(uint8_t);
tgt++;
}
}
}
@ -163,10 +165,11 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
res = 0;
for (unsigned i = 0;
(res < opt->data_len) && (i < GNRC_NETIF_IPV6_GROUPS_NUMOF);
i++, tgt++) {
i++) {
if (!ipv6_addr_is_unspecified(&netif->ipv6.groups[i])) {
memcpy(tgt, &netif->ipv6.groups[i], sizeof(ipv6_addr_t));
res += sizeof(ipv6_addr_t);
tgt++;
}
}
}