mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #1781 from authmillenon/sixlowpan-fix-prefix-init
sixlowpan: fix ipv6_addr_init_prefix
This commit is contained in:
commit
ded314b29e
@ -651,16 +651,15 @@ void ipv6_addr_init_prefix(ipv6_addr_t *out, const ipv6_addr_t *prefix,
|
|||||||
uint8_t bytes = bits / 8, mask;
|
uint8_t bytes = bits / 8, mask;
|
||||||
|
|
||||||
if (bits % 8) {
|
if (bits % 8) {
|
||||||
mask = 0xff << (bits - (bytes * 8));
|
mask = 0xff << (8 - (bits - (bytes * 8)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mask = 0x00;
|
mask = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes++;
|
|
||||||
memset(out, 0, 16);
|
|
||||||
memcpy(out, prefix, bytes);
|
memcpy(out, prefix, bytes);
|
||||||
out->uint8[bytes] = prefix->uint8[bytes] & mask;
|
out->uint8[bytes] = prefix->uint8[bytes] & mask;
|
||||||
|
memset(&(out[bytes + 1]), 0, 15 - bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ipv6_net_if_get_best_src_addr(ipv6_addr_t *src, const ipv6_addr_t *dest)
|
void ipv6_net_if_get_best_src_addr(ipv6_addr_t *src, const ipv6_addr_t *dest)
|
||||||
|
Loading…
Reference in New Issue
Block a user