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

ndp: separate & clean next hop & l2 determination #3622

Closed
wants to merge 11 commits into from

Conversation

OlegHahm
Copy link
Member

Determining the next hop and the corresponding L2 address are split up
in two steps. No next hop look up is performed for link-local addresses
any more. Destination cache has been disabled.

@OlegHahm OlegHahm added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation NSTF labels Aug 13, 2015
@OlegHahm
Copy link
Member Author

After discussing with @emmanuelsearch and @cgundogan, we could not find a use case where the destination cache would introduce any benefit.

@OlegHahm
Copy link
Member Author

Also, putting link-local addresses in the FIB (or looking them up there) is rather useless (see also https://tools.ietf.org/html/rfc5889).

@OlegHahm OlegHahm mentioned this pull request Aug 13, 2015
@miri64
Copy link
Member

miri64 commented Aug 13, 2015

I don't see the benefit of splitting the function up.

@OlegHahm
Copy link
Member Author

Next-hop determination and looking a l2 address up are two different things.

@OlegHahm
Copy link
Member Author

(The l2 lookup function is still too long anyway.)

if (ipv6_addr_is_link_local(&(hdr->dst))) {
memcpy(&next_hop_ip, &(hdr->dst), sizeof(ipv6_addr_t));
}
else if (!ng_ndp_node_next_hop_ipv6_addr(&next_hop_ip, &iface,
Copy link
Member

Choose a reason for hiding this comment

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

If we go for this this way, this function needs to be wrapped in the same manner as ng_ndp_node_next_hop_l2addr() is in https://github.com/RIOT-OS/RIOT/pull/3622/files#diff-c0ab51e027bbe0cfdb3482d3e29d6f34R569.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why?

Copy link
Member

Choose a reason for hiding this comment

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

Because next-hop determination for 6LoWPAN-ND is not the same as for NDP.

Copy link
Member

Choose a reason for hiding this comment

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

(in 6LoWPAN-ND it even is different for routers and hosts):

Copy link
Member Author

Choose a reason for hiding this comment

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

But this is not implemented yet anyway, but actually looking at the RFC I don't see a big difference for the next-hop determination itself.

@miri64
Copy link
Member

miri64 commented Aug 13, 2015

Next-hop determination and looking a l2 address up are two different things.

Yes, but there is no use case where they are used separately. They are always used together and always in the exact same order. So why not safe some ROM and put them together in one function (this was my original rational).

@OlegHahm
Copy link
Member Author

For link-local addresses a FIB lookup is not needed (without destination cache).

@miri64
Copy link
Member

miri64 commented Aug 13, 2015

Yes, but on-link prefix determination and default router determination. Also the diff is kind of messy so I'm not sure, but can it be that you forgot on-link prefix determination?

@miri64
Copy link
Member

miri64 commented Aug 13, 2015

Next-hop determination for a given unicast destination operates as
follows. The sender performs a longest prefix match against the
Prefix List to determine whether the packet's destination is on- or
off-link. If the destination is on-link, the next-hop address is the
same as the packet's destination address. Otherwise, the sender
selects a router from the Default Router List (following the rules
described in Section 6.3.6).

@OlegHahm
Copy link
Member Author

I read this.

@OlegHahm
Copy link
Member Author

On-link determination in wireless networks is difficult anyway (see RFC 5889). The current implementation seems to look up a flag for an address configured to a local address for on-link determination which seems weird.

@miri64
Copy link
Member

miri64 commented Aug 13, 2015

On-link determination in wireless networks is difficult anyway (see RFC 5889).

We don't deal with just wireless networks anymore. As far as I read RFC 5889 prefixes should just not be configured to be on-link (so you are not to allowed the flag) for such networks. That's a situation we have to deal with, but not by omitting on-link prefix determination all-together but by proper prefix initialization.

The current implementation seems to look up a flag for an address configured to a local address for on-link determination which seems weird.

Why? In RIOT the prefix list and the local address list are the same (as proposed by RFC 4861) and on-link is a flag of this prefix. It is either set on the prefix' initialization (when a user adds an address to the interface - this is the point we need to change in regard to RFC 5889) or when it receives the prefix via a PIO with the on-link flag set. This and checking the neighbor cache are the only options in our current implementation if you take the definition in RFC 4861 in account

   on-link     - an address that is assigned to an interface on a
                 specified link.  A node considers an address to be on-
                 link if:

                    - it is covered by one of the link's prefixes (e.g.,
                      as indicated by the on-link flag in the Prefix
                      Information option), or

                    - a neighboring router specifies the address as the
                      target of a Redirect message, or

                    - a Neighbor Advertisement message is received for
                      the (target) address, or

                    - any Neighbor Discovery message is received from
                      the address.

@miri64
Copy link
Member

miri64 commented Aug 13, 2015

Yes I actually forgot to check the neighbor cache in the current implementation, but this is actually an argument FOR keeping the function together. Otherwise you would have to look into the neighbor cache twice to make a clean implementation: once when you determine the next hop and then for link-layer address determination.

@OlegHahm
Copy link
Member Author

We don't deal with just wireless networks anymore. As far as I read RFC 5889 prefixes should just not be configured to be on-link (so you are not to allowed the flag) for such networks. That's a situation we have to deal with, but not by omitting on-link prefix determination all-together but by proper prefix initialization.

True, we're not dealing only with wireless networks, but for now most of the time. My argument (and I think also @emmanuelsearch's one) is that "on-link" is difficult to determine in wireless networks. Thinking about failing nodes, changing links and unidirectional links.

Why? In RIOT the prefix list and the local address list are the same (as proposed by RFC 4861) and on-link is a flag of this prefix.

Is this documented somewhere? The lookup as it is in the current implementation without any comment looks just weird.

Summa summarum, I would argue that at least for the wireless case on-link determination per prefix is pointless and should be omitted. So this should at least be configurable. @emmanuelsearch, what do you think?

@miri64
Copy link
Member

miri64 commented Aug 14, 2015

Is this documented somewhere? The lookup as it is in the current implementation without any comment looks just weird.

Seems not to be, but the fact alone, that the assigned addresses have also a prefix length assigned to them makes it a prefix list (otherwise it wouldn't be needed)

@miri64
Copy link
Member

miri64 commented Aug 14, 2015

Summa summarum, I would argue that at least for the wireless case on-link determination per prefix is pointless and should be omitted. So this should at least be configurable. @emmanuelsearch, what do you think?

Then make it configurable using a flag or something. We have at least one device regular used that isn't wireless: native.

@emmanuelsearch
Copy link
Member

Concerning "on-link" and spontaneous wireless networks, I think about section 6.1. of RFC5889. Basically in our context, on-link means nothing useful, so I am of the opinion of (i) not using this concept and associated flags in wireless context and (ii) focus on using non-link-local address as much of the time in wireless context.

@OlegHahm
Copy link
Member Author

We have at least one device regular used that isn't wireless: native.

Nit-picky: native is not device. More seriously: we want native to behave as much as possible as real devices, so I wouldn't make an exception for native. However, I agree that we might want to distinguish between wireless and wired (Ethernet, MS/TP...).

@OlegHahm OlegHahm added the State: waiting for other PR State: The PR requires another PR to be merged first label Aug 23, 2015
@OlegHahm
Copy link
Member Author

Updated and rebased on #3697.

Now on-link prefix lookup is only performed for wired interfaces.

@OlegHahm
Copy link
Member Author

rebased on current master

@miri64
Copy link
Member

miri64 commented Aug 31, 2015

@OlegHahm
Copy link
Member Author

OlegHahm commented Sep 1, 2015

I considered as soon as I saw the PR, but since the address is memcopied now anyway, this doesn't apply.

@OlegHahm OlegHahm modified the milestone: Release NEXT MAJOR Sep 2, 2015
@cgundogan
Copy link
Member

needs rebase

(next_hop_size == sizeof(ipv6_addr_t))) {
next_hop_ip = &next_hop_actual;
}
next_hop_ip = gnrc_ipv6_ext_rh_next_hop(hdr);
Copy link
Contributor

Choose a reason for hiding this comment

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

This only modify a local pointer variable. We should memcpy like this.

ipv6_addr *tmp = gnrc_ipv6_ext_rh_next_hop(hdr);

if (tmp != NULL) {
    memcpy(next_hop_ip, tmp, sizeof(ipv6_addr_t));
    return true;
}

Alternatively, change signature like this:

bool gnrc_ndp_node_next_hop_ipv6_addr(ipv6_addr_t **next_hop_ip, ...)
{
    *next_hop_ip = gnrc_ipv6_ext_rh_next_hop(hdr);
    ...
}

call site:

  ipv6_addr_t *next_hop_ip;

  gnrc_ndp_node_next_hop_ipv6_addr(&next_hop_ip, ...);

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the hint. In fact this PR is very outdated and I just left it open to remind me of re-introducing it as a new one anytime soon.

@miri64
Copy link
Member

miri64 commented Jan 26, 2016

Needs rebase.

@OlegHahm
Copy link
Member Author

I will abandon this for now.

@OlegHahm OlegHahm closed this Jan 26, 2016
@OlegHahm OlegHahm added the State: archived State: The PR has been archived for possible future re-adaptation label Jan 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable State: archived State: The PR has been archived for possible future re-adaptation State: waiting for other PR State: The PR requires another PR to be merged first Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants