README.txt 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. 6LoWPAN Contents
  2. ----------------
  3. o 6LoWPAN Addressing
  4. o IPv6 Neighbor Discovery
  5. o Optimal 6LoWPAN Configuration
  6. o Star Configuration
  7. 6LoWPAN Addressing
  8. ------------------
  9. The current 6LoWPAN implementation uses only link local, MAC-based
  10. addressing addressing (as discussed in more detail below). Thus if you know
  11. the node addressing, then you know the IPv6 address (and vice-versa).
  12. As a configuration option, the 6LoWPAN implementation will use either the
  13. node's 2-byte short address or 8-byte extended address as the MAC address
  14. that the IPv6 address is based on. This is determined by the configuration
  15. setting CONFIG_NET_6LOWPAN_EXTENDEDADDR. By default, the 2-byte short
  16. address is used for the IEEE802.15.4 MAC device's link layer address. If
  17. this option is selected, then an 8-byte extended address will be used,
  18. instead.
  19. All nodes operating on a network have unique, 8-byte extended address,
  20. that was assigned before the network is configured. 6LoWPAN will use
  21. either the extended address for direct communication within the PAN or
  22. the short 2-byte address. The short 2-byte address, however, is allocated
  23. by the PAN coordinator when the device associated. If short addresses are
  24. used, the network cannot be brought up until is is associated.
  25. Node addressing is modified through IOCTL calls from application logic.
  26. The network must be in the DOWN state when ever the node addressing is
  27. modified. The modified node addresses will have no effect on the reported
  28. IPv6 address until the network is brought to the UP state. The new IPv6
  29. MAC-based addresses are only instantiated when the network transitions
  30. from the DOWN to UP state.
  31. IPv6 Neighbor Discovery
  32. -----------------------
  33. IPv6 Neighbor Discovery is not supported. The current ICMPv6 and neighbor-
  34. related logic only works with Ethernet MAC. For 6LoWPAN, a new more
  35. conservative IPv6 neigbor discovery is provided by RFC 6775 which is not
  36. currently supported. With IPv6 neighbor discovery, any IPv6 address may be
  37. associated with any short or extended address. In fact, that is the whole
  38. purpose of the neighbor discover logic: It plays the same role as ARP in
  39. IPv4; it ultimately just manages a neighbor table that, like the arp table,
  40. provides the mapping between IP addresses and node addresses.
  41. The NuttX, Contiki-based 6LoWPAN implementation circumvents the need for
  42. the neighbor discovery logic by using only MAC-based addressing, i.e., the
  43. lower two or eight bytes of the IP address are the node address.
  44. Most of the 6LoWPAN compression algorithms exploit this kind of addressing
  45. to compress the IPv6 address to nothing but a single bit indicating that the
  46. IP address derives from the node address. In this use case, IPv6 neighbor
  47. discover is not useful: If we want to use IPv6 neighbor discovery, we could
  48. dispense with the all MAC based addressing. But if we want to retain the
  49. more compact MAC-based addressing, then we don't need IPv6 neighbor discovery.
  50. However, it would still be nice to have enough in place to support ping6.
  51. Full neighbor support would be necessary if we wanted to route 6LoWPAN frames
  52. outside of the WPAN.
  53. Optimal 6LoWPAN Configuration
  54. -----------------------------
  55. 1. Link local IP addresses:
  56. 128 112 96 80 64 48 32 16
  57. fe80 0000 0000 0000 xxxx xxxx xxxx xxxx
  58. 2. MAC-based IP addresses:
  59. 128 112 96 80 64 48 32 16
  60. ---- ---- ---- ---- ---- ---- ---- ----
  61. AAAA xxxx xxxx xxxx xxxx 00ff fe00 MMMM 2-byte short address IEEE 48-bit MAC
  62. AAAA 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte extended address IEEE EUI-64
  63. Where MMM is the 2-byte short address XORed 0x0200. For example, the MAC
  64. address of 0xabcd would be 0xa9cd. And NNNN NNNN NNNN NNNN is the 8-byte
  65. extended address address XOR 02000 0000 0000 0000.
  66. For link-local address, AAAA is 0xfe80
  67. 3. MAC based link-local addresses
  68. 128 112 96 80 64 48 32 16
  69. ---- ---- ---- ---- ---- ---- ---- ----
  70. fe80 0000 0000 0000 0000 00ff fe00 MMMM 2-byte short address IEEE 48-bit MAC
  71. fe80 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte extended address IEEE EUI-64
  72. 4. To be compressable, port numbers must be in the range 0xf0b0-0xf0bf,
  73. hexadecimal. That is 61616-61631 decimal.
  74. 5. IOBs: Must be big enough to hold one IEEE802.15.4 frame (typically 127).
  75. There must be enough IOBs to decompose the largest IPv6 packet
  76. (CONFIG_NET_6LOWPAN_PKTSIZE, default 1294, plus per frame overhead).
  77. Fragmentation Headers
  78. ---------------------
  79. A fragment header is placed at the beginning of the outgoing packet just
  80. after the MAC header when the payload is too large to fit in a single IEEE
  81. 802.15.4 frame. The fragment header contains three fields: Datagram size,
  82. datagram tag and datagram offset.
  83. 1. Datagram size describes the total (un-fragmented) payload.
  84. 2. Datagram tag identifies the set of fragments and is used to match
  85. fragments of the same payload.
  86. 3. Datagram offset identifies the fragment’s offset within the un-
  87. fragmented payload (in units of 8 bytes).
  88. The length of the fragment header length is four bytes for the first header
  89. (FRAG1) and five bytes for all subsequent headers (FRAGN). For example,
  90. this is a HC1 compressed first frame of a packet
  91. 41 88 2a cefa 3412 cdab ### 9-byte MAC header
  92. c50e 000b ### 4-byte FRAG1 header
  93. 42 ### SIXLOWPAN_DISPATCH_HC1
  94. fb ### SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING
  95. e0 ### SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING
  96. 00 ### SIXLOWPAN_HC1_HC_UDP_TTL
  97. 10 ### SIXLOWPAN_HC1_HC_UDP_PORTS
  98. 0000 ### SIXLOWPAN_HC1_HC_UDP_CHKSUM
  99. 104 byte Payload follows:
  100. 4f4e452064617920 48656e6e792d7065 6e6e792077617320 7069636b696e6720
  101. 757020636f726e20 696e207468652063 6f726e7961726420 7768656e2d2d7768
  102. 61636b212d2d736f 6d657468696e6720 6869742068657220 75706f6e20746865
  103. 20686561642e2027
  104. This is the second frame of the same transfer:
  105. 41 88 2b cefa 3412 cdab ### 9-byte MAC header
  106. e50e 000b 0d ### 5 byte FRAGN header
  107. 42 ### SIXLOWPAN_DISPATCH_HC1
  108. fb ### SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING
  109. e0 ### SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING
  110. 00 ### SIXLOWPAN_HC1_HC_UDP_TTL
  111. 10 ### SIXLOWPAN_HC1_HC_UDP_PORTS
  112. 0000 ### SIXLOWPAN_HC1_HC_UDP_CHKSUM
  113. 104 byte Payload follows:
  114. 476f6f646e657373 2067726163696f75 73206d6521272073 6169642048656e6e
  115. 792d70656e6e793b 202774686520736b 79277320612d676f 696e6720746f2066
  116. 616c6c3b2049206d 75737420676f2061 6e642074656c6c20 746865206b696e67
  117. 2e270a0a536f2073
  118. The payload length is encoded in the LS 11-bits of the first 16-bit value:
  119. In this example the payload size is 0x050e or 1,294. The tag is 0x000b. In
  120. the second frame, the fifth byte contains the offset 0x0d which is 13 << 3 =
  121. 104 bytes, the size of the payload on the first packet.
  122. Star Configuration
  123. ------------------
  124. The 6LoWPAN stack can be specially configured as member in a star topology;
  125. either as a endpoint on the star os the star hub. The endpoint is
  126. created with the following settings in the configuration file:
  127. CONFIG_NET_STAR=y
  128. CONFIG_NET_STARPOINT=y
  129. The CONFIG_NET_STARPOINT selection informs the endpoint 6LoWPAN stack that
  130. it must send all frames to the hub of the star, rather than directly to the
  131. recipient. The star hub is assumed to be the cooordinator.
  132. The star hub configuration, on the other hand, uses these setting:
  133. CONFIG_NET_STAR=y
  134. CONFIG_NET_STARHUB=y
  135. CONFIG_NET_IPFORWARD=y
  136. The CONFIG_NET_IPFORWARD selection informs the hub that if it receives any
  137. packets that are not destined for the hub, it should forward those packets
  138. appropriately. This affects the behavior of IPv6 packet reception logic but
  139. does not change the behavior of the 6LoWPAN stack.