From e9d6eb81707905f8d7084214ca274984a76fb473 Mon Sep 17 00:00:00 2001
From: Oleg Hahm <oleg@hobbykeller.org>
Date: Thu, 24 Sep 2015 00:37:37 +0200
Subject: [PATCH] 6lowpan IPHC: set stateful compression mode f. dst

For destionation addresses the stateful compression mode bit wasn't set.
---
 .../network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c   | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/net/gnrc/network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c b/sys/net/gnrc/network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c
index e8a1e00b0e..2ff2b66c2a 100644
--- a/sys/net/gnrc/network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c
+++ b/sys/net/gnrc/network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c
@@ -618,6 +618,15 @@ bool gnrc_sixlowpan_iphc_encode(gnrc_pktsnip_t *pkt)
               ipv6_addr_is_link_local(&ipv6_hdr->dst)) && (netif_hdr->dst_l2addr_len > 0)) {
         eui64_t iid;
 
+        if (dst_ctx != NULL) {
+            /* stateful destination address compression */
+            iphc_hdr[IPHC2_IDX] |= SIXLOWPAN_IPHC2_DAC;
+
+            if (((dst_ctx->flags_id & GNRC_SIXLOWPAN_CTX_FLAGS_CID_MASK) != 0)) {
+                iphc_hdr[CID_EXT_IDX] |= ((dst_ctx->flags_id & GNRC_SIXLOWPAN_CTX_FLAGS_CID_MASK) << 4);
+            }
+        }
+
         ieee802154_get_iid(&iid, gnrc_netif_hdr_get_dst_addr(netif_hdr),
                            netif_hdr->dst_l2addr_len);
 
-- 
GitLab