gnrc_sixlowpan_iphc.c: Updated comments some logic

This commit is contained in:
Martin Elshuber 2016-11-08 13:04:12 +01:00
parent faa47a0e03
commit b582e64b09

View File

@ -612,16 +612,20 @@ bool gnrc_sixlowpan_iphc_encode(gnrc_pktsnip_t *pkt)
/* check for available contexts */ /* check for available contexts */
if (!ipv6_addr_is_unspecified(&(ipv6_hdr->src))) { if (!ipv6_addr_is_unspecified(&(ipv6_hdr->src))) {
src_ctx = gnrc_sixlowpan_ctx_lookup_addr(&(ipv6_hdr->src)); src_ctx = gnrc_sixlowpan_ctx_lookup_addr(&(ipv6_hdr->src));
/* do not use for compression if GNRC_SIXLOWPAN_CTX_FLAGS_CID_MASK is not set */ /* do not use source context for compression if */
if (!(src_ctx->flags_id & GNRC_SIXLOWPAN_CTX_FLAGS_COMP)) /* GNRC_SIXLOWPAN_CTX_FLAGS_COMP is not set */
if (src_ctx && !(src_ctx->flags_id & GNRC_SIXLOWPAN_CTX_FLAGS_COMP)) {
src_ctx = NULL; src_ctx = NULL;
}
} }
if (!ipv6_addr_is_multicast(&ipv6_hdr->dst)) { if (!ipv6_addr_is_multicast(&ipv6_hdr->dst)) {
dst_ctx = gnrc_sixlowpan_ctx_lookup_addr(&(ipv6_hdr->dst)); dst_ctx = gnrc_sixlowpan_ctx_lookup_addr(&(ipv6_hdr->dst));
/* do not use for compression if GNRC_SIXLOWPAN_CTX_FLAGS_CID_MASK is not set */ /* do not use destination context for compression if */
if (!(dst_ctx->flags_id & GNRC_SIXLOWPAN_CTX_FLAGS_COMP)) /* GNRC_SIXLOWPAN_CTX_FLAGS_COMP is not set */
if (dst_ctx && !(dst_ctx->flags_id & GNRC_SIXLOWPAN_CTX_FLAGS_COMP)) {
dst_ctx = NULL; dst_ctx = NULL;
}
} }
/* if contexts available and both != 0 */ /* if contexts available and both != 0 */