-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gnrc_ndp: fixed ND Option handling for 6LoWPAN #4446
gnrc_ndp: fixed ND Option handling for 6LoWPAN #4446
Conversation
if (ipv6_iface->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN) { | ||
// https://tools.ietf.org/html/rfc4944#section-8 | ||
if (sl2a_opt->len == 1) { | ||
sl2a_len = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have also 1-bit devices in mind to use with 6Lo, this might not be true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1-bit addresses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1-byte addresses ^^ sorry.
After reviewing the problem: It runs a little bit deeper. Basically what I assumed (and was trying to communicate to the driver developers at that time) is that the driver always takes addresses that are shorter than the required ones, and pads them with 0 at the end. Sadly it seems that this never was included into any of the link-layer implementations. The problem with the current solution is, that it expects the device either to be 24-bit MAC address compatible or an IEEE 802.15.4 device (16-bit and 64-bit addresses). Since 6Lo by now is target to devices that support different addresses (and the cc11xx [8-bit addresses] was historically the device we implemented 6Lo over first), this leaves all this devices in an uncertain (probably unsupported) state. Do we have a solution for that (apart from the already proposed less strict address acceptance by drivers)? @haukepetersen @kaspar030 @OlegHahm @thomaseichinger @jfischer-phytec-iot @jremmert-phytec-iot |
If configured correctly NETOPT_ADDR_LEN should give you the same values and would be much more general than the proposed solution. |
@authmillenon What if the sender has 64-bit address and the receiver has 16-bit address? XBee (or other IEEE 802.15.4 devices) allows this. |
Interpretation of Source/Target Link-layer Address option is delegated for each standards of IPv6-over-X (https://tools.ietf.org/html/rfc4861#section-4.6.1). 48 bits for IPv6 over Ethernet (https://tools.ietf.org/html/rfc2464#section-6), 16 or 64 bits depending on the length parameter for IPv6 over IEEE 802.15.4 (https://tools.ietf.org/html/rfc4944#section-8). We have to check the type of the link-layer to determine its address length. If |
Maybe it would suffice to have a default L2 address length member to the interface (1 byte should be enough for this, we can still squeeze this in somewhere). Since IEEE 802.15.4 is the only format I know of we can have the following exception: if default L2 address length == 2 and |
Updated to use |
* regardless of link-layer address. | ||
* https://tools.ietf.org/html/rfc6775#section-4.1 */ | ||
if ((nc_entry = gnrc_ipv6_nc_add(iface, &ipv6->src, | ||
&ar_opt->eui64, sizeof(eui64_t), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errm this entry will be used for address translation, too (so with this patch short addresses won't be used as destination addresses). The EUI-64 to identify the node in address registration is set in https://github.com/RIOT-OS/RIOT/pull/4446/files#diff-9b0aedc5fd4543061c862e245fe43c75R359 and checked in https://github.com/RIOT-OS/RIOT/pull/4446/files#diff-9b0aedc5fd4543061c862e245fe43c75R337
Apart from the confusion about the hardware address (used for address resolution) and the EUI-64 (used for neighbor identification in address registration) I like this solution much better (even better then the one proposed by myself :-)) |
sl2a_len = 2; | ||
} else if (sl2a_opt->len == 2) { | ||
sl2a_len = 8; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs some style fixes (/* .. */
instead of //
and newline before else
).
Updated. I will do |
@@ -347,7 +347,8 @@ uint8_t gnrc_sixlowpan_nd_opt_ar_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6, | |||
/* TODO: multihop DAD behavior */ | |||
uint16_t reg_ltime; | |||
if (nc_entry == NULL) { | |||
if ((nc_entry = gnrc_ipv6_nc_add(iface, &ipv6->src, sl2a, sl2a_len, | |||
if ((nc_entry = gnrc_ipv6_nc_add(iface, &ipv6->src, | |||
sl2a, sl2a_len, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this change about?
Apart from unnecessary formatting changes, this PR is ready to be merged |
@Yonezawa-T2 could you also provide a backport to the release branch after addressing the minor comments of @authmillenon ? |
@Yonezawa-T2 thanks again for the work that you contributed here. We want to create a new release candidate in the next few (2-3) hours and having your fixes in this release would be most beneficial. If you think that you can address the comments of @authmillenon within a short period of time then we will gladly wait a few hours longer in order to get these fixes merged and backported. |
The forms of the Source/Target Link-layer Address option for 6LoWPAN are defined in RFC 4944 Section 8: https://tools.ietf.org/html/rfc4944#section-8 The address is 16 bit if length is 1, 64 bit if length is 2.
d6cba96
to
639f7dc
Compare
Sorry for my late response. I was offline. Reverted unnecessary style changes, then squashed all commits. |
ACK and go when Travis is happy |
(please provide a backport to the |
Created #4581 for 2015.12-branch |
…or_6lowpan gnrc_ndp: fixed ND Option handling for 6LoWPAN
Thanks for your help and patience. :-) |
The form of Source/Target Link-layer Address option of Neighbor Discovery protocol is defined by RFC 4944 Section 8 for 6LoWPAN. Link-layer addresses may be used by 6LoWPAN to restore IPv6 addresses, so that wrong handling may results in check sum error of ICMPv6.
Tested on OS X with modifications of #4443, #4444, and #4445.