6LoWPAN: Add missing IPv6 address creation to HC1 decode logic.

This commit is contained in:
Gregory Nutt
2017-06-23 09:44:36 -06:00
parent 66f3186c76
commit 1a46ea644d
7 changed files with 198 additions and 45 deletions
+29 -5
View File
@@ -126,15 +126,39 @@
#define SIXLOWPAN_DISPATCH_FRAGN 0xe0 /* 11100xxx Fragmentation header (subsequent) */
#define SIXLOWPAN_DISPATCH_FRAG_MASK 0xf8 /* 11111000 */
/* HC1 encoding */
/* HC1 encoding (RFC4944)
*
* PI: Prefix carried in-line
* PC: Prefix compressed (link-local prefix assumed)
* II: Interface identifier carried in-line
* IC: Interface identifier elided (derivable from the corresponding
* link-layer address).
*/
#define SIXLOWPAN_HC1_NH_UDP 0x02
#define SIXLOWPAN_HC1_NH_TCP 0x06
#define SIXLOWPAN_HC1_NH_ICMP6 0x04
#define SIXLOWPAN_HC1_SRCADDR_MASK 0xc0 /* Bits 0-1: IPv6 source address */
# define SIXLOWPAN_HC1_SRCADDR_PIII 0x00 /* PI,II */
# define SIXLOWPAN_HC1_SRCADDR_PIIC 0x40 /* PI,IC */
# define SIXLOWPAN_HC1_SRCADDR_PCII 0x80 /* PC,II */
# define SIXLOWPAN_HC1_SRCADDR_PCIC 0xc0 /* PC,IC */
#define SIXLOWPAN_HC1_DESTADDR_MASK 0x30 /* Bits 2-3: IPv6 destination address */
# define SIXLOWPAN_HC1_DESTADDR_PIII 0x00 /* PI,II */
# define SIXLOWPAN_HC1_DESTADDR_PIIC 0x10 /* PI,IC */
# define SIXLOWPAN_HC1_DESTADDR_PCII 0x20 /* PC,II */
# define SIXLOWPAN_HC1_DESTADDR_PCIC 0x30 /* PC,IC */
#define SIXLOWPAN_HC1_TCFL_C 0x08 /* Traffic class and flow label are zero */
#define SIXLOWPAN_HC1_NH_MASK 0x06 /* Bits 5-6: Next HC1 header type */
# define SIXLOWPAN_HC1_NH_NC 0x00 /* Not compressed */
# define SIXLOWPAN_HC1_NH_UDP 0x02 /* UDP */
# define SIXLOWPAN_HC1_NH_ICMPv6 0x04 /* ICMPv6 */
# define SIXLOWPAN_HC1_NH_TCP 0x06 /* TCP */
#define SIXLOWPAN_HC1_H2ENCODE 0x01 /* Bit 0: HC2 encoding follows */
/* HC_UDP encoding (works together with HC1) */
#define SIXLOWPAN_HC_UDP_ALL_C 0xe0
#define SIXLOWPAN_HC_UDP_SRCPORT_C 0x80 /* Source port compressed to 4 bits */
#define SIXLOWPAN_HC_UDP_DESTPORT_C 0x40 /* Destination port compressed to 4 bits */
#define SIXLOWPAN_HC_UDP_LENGTH _C 0x20 /* Elided, compute from IPv6 length */
#define SIXLOWPAN_HC_UDP_ALL_C 0xe0 /* All commpressed */
/* IPHC encoding
*