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

ng_ipv6: set default values for src and dst in ng_ipv6_hdr_build()

Later in the handling of IPv6 headers, the source address is only
automatically chosen and filled into the header if the unspecified
address is found in the src field, but it's never set to that value.

The default destination address is set to '::1'.
This commit is contained in:
Sebastian Sontberg 2015-05-12 19:14:05 +02:00
parent 714c10e44f
commit c0ec7eb892

View File

@ -63,6 +63,10 @@ ng_pktsnip_t *ng_ipv6_hdr_build(ng_pktsnip_t *payload,
#endif
memcpy(&hdr->src, src, src_len);
}
else {
DEBUG("ipv6_hdr: set packet source to ::\n");
ng_ipv6_addr_set_unspecified(&hdr->src);
}
memset(&hdr->dst + dst_len, 0, sizeof(ng_ipv6_addr_t) - dst_len);
@ -74,6 +78,10 @@ ng_pktsnip_t *ng_ipv6_hdr_build(ng_pktsnip_t *payload,
#endif
memcpy(&hdr->dst, dst, dst_len);
}
else {
DEBUG("ipv6_hdr: set packet destination to ::1\n");
ng_ipv6_addr_set_loopback(&hdr->dst);
}
hdr->v_tc_fl = byteorder_htonl(0x60000000); /* set version, tc and fl in one go*/
hdr->nh = NG_PROTNUM_RESERVED;