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

Merge pull request #2974 from sgso/fix_unspecified_src_addr_in_ng_ipv6

ng_ipv6: set default values for src and dst in ng_ipv6_hdr_build()
This commit is contained in:
Oleg Hahm 2015-05-13 19:02:44 +02:00
commit 05f47b2a81

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;