Skip to content
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

Merged

Conversation

Yonezawa-T2
Copy link
Contributor

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.

@OlegHahm OlegHahm added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking NSTF labels Dec 9, 2015
@OlegHahm OlegHahm added this to the Release 2015.12 milestone Dec 9, 2015
@OlegHahm OlegHahm added the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Dec 9, 2015
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;
Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1-bit addresses?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1-byte addresses ^^ sorry.

@miri64
Copy link
Member

miri64 commented Dec 9, 2015

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

@miri64 miri64 added the Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. label Dec 9, 2015
@miri64
Copy link
Member

miri64 commented Dec 14, 2015

If configured correctly NETOPT_ADDR_LEN should give you the same values and would be much more general than the proposed solution.

@Yonezawa-T2
Copy link
Contributor Author

@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.

@Yonezawa-T2
Copy link
Contributor Author

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 GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN flag is insufficient, we need to add GNRC_IPV6_NETIF_FLAGS_CC11XX flag and GNRC_IPV6_NETIF_FLAGS_IEEE_802_15_4 flag.

@miri64
Copy link
Member

miri64 commented Dec 15, 2015

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 sl2a_opt->len == 2 then set address length to 8.

@Yonezawa-T2
Copy link
Contributor Author

Updated to use sl2a_opt->len iff src_l2addr_len is 2 or 8.

* 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),
Copy link
Member

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

@miri64
Copy link
Member

miri64 commented Dec 15, 2015

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 {
Copy link
Member

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).

@Yonezawa-T2
Copy link
Contributor Author

Updated. I will do git rebase -i to squash those changes when it is ready to merge.

@@ -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,
Copy link
Member

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?

@miri64
Copy link
Member

miri64 commented Jan 4, 2016

Apart from unnecessary formatting changes, this PR is ready to be merged

@cgundogan
Copy link
Member

@Yonezawa-T2 could you also provide a backport to the release branch after addressing the minor comments of @authmillenon ?

@cgundogan
Copy link
Member

@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.
@Yonezawa-T2 Yonezawa-T2 force-pushed the neighbor_discovery_option_for_6lowpan branch from d6cba96 to 639f7dc Compare January 6, 2016 00:39
@Yonezawa-T2
Copy link
Contributor Author

Sorry for my late response. I was offline.

Reverted unnecessary style changes, then squashed all commits.

@miri64 miri64 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 6, 2016
@miri64
Copy link
Member

miri64 commented Jan 6, 2016

ACK and go when Travis is happy

@miri64
Copy link
Member

miri64 commented Jan 6, 2016

(please provide a backport to the 2015.12-branch)

@Yonezawa-T2
Copy link
Contributor Author

Created #4581 for 2015.12-branch

@miri64 miri64 removed the Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. label Jan 6, 2016
@cgundogan cgundogan removed the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Jan 6, 2016
miri64 added a commit that referenced this pull request Jan 6, 2016
…or_6lowpan

gnrc_ndp: fixed ND Option handling for 6LoWPAN
@miri64 miri64 merged commit a4a8e83 into RIOT-OS:master Jan 6, 2016
@miri64
Copy link
Member

miri64 commented Jan 6, 2016

Thanks for your help and patience. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants