Skip to content
Snippets Groups Projects
Commit c0ec7eb8 authored by Sebastian Sontberg's avatar Sebastian Sontberg
Browse files

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'.
parent 714c10e4
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment