-
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
ng_ndp: initial import of address resolution #2910
Conversation
78a52fb
to
4f54b07
Compare
Rebased to current master and current dependencies |
4f54b07
to
4759e0e
Compare
4759e0e
to
dbf9a24
Compare
Added #2964 as dependency |
dbf9a24
to
15fb07e
Compare
New fixes. |
0b6af41
to
56c3d09
Compare
Rebased to current dependencies |
(no longer WIP, but still untested) |
Tested and fixed bugs I found. Please test (hope there are devices to test this with...). |
31bc6bf
to
afa5c7a
Compare
Problems I ran into so far with current devices:
The way I did it:
Great now I know at least, that the initial probing works, but how do I test the receiving side:
sendp(Ether(src="<the tap's MAC address>", dst="<RIOT's MAC>") / \
IPv6(src="fe80::1", dst="RIOT's IPv6 address") / \
ICMPv6ND_NA(tgt="fe80::1",O=0,R=0,S=1) / \
ICMPv6NDOptDstLLAddr(lladdr="<the tap's MAC address>"), \
iface="<the name of the tap>") Both RIOT's MAC and IPv6 address can be determined with
|
If you want to test the receiving of Neighbor Solicitations you can do that with scapy, too: srp(Ether(src="<the tap's MAC address>", dst="<RIOT's MAC>") / \
IPv6(src="fe80::1", dst="ff02::1") / \
ICMPv6ND_NS(tgt="fe80::1") / \
ICMPv6NDOptSrcLLAddr(lladdr="<the tap's MAC address>"), \
iface="<the name of the tap>") Instead of You will observe a Neighbor Advertisement being replied. The neighbor cache entry is first set to
|
What do you mean? Works like charm, but does neither work with Linux nor between two RIOT native instances? |
See my [edit: test] descriptions below ;-) As I said: I think it's more a configuring problem of the TAP, than the implementation, since the packets seem to be correct. |
It's seems to be a race: contiki-os/contiki#1063 (comment) 😉 |
Unfair! They have a headstart :D |
router = ng_ipv6_nc_get_next_router(router); | ||
|
||
if (router == NULL) { /* still nothing found => no router in list */ | ||
return NULL; |
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 looks ugly, but I don't have a better idea for now. Maybe introduce an is_empty()
function.
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.
Just for this one use-case? Seems inefficient to me... Especially since the code would basically look the same, just with an extra && !ng_ipv6_nc_is_empty()
in l320, if I see this correctly.
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.
Well, yes... But you agree that this double check looks weird, right?
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.
Yes, but is_empty()
is not the semantic we look for here. The router list is more like a circular list which is costly compared to the current array-list implementation, so …
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.
Yes, but if both calls return NULL
the list is empty, right?
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.
Yes… but this is not how this is to be used here: the first ng_ipv6_nc_get_next_router()
tries to round-robin the routers. Problem: since the router list (a subset of the neighbor cache) is an array list, the function returns NULL
for both cases that the list is empty or the list has reached its end. The second call than checks if the list was empty or not and additionally retrieves a router if it was not empty. This means, unless I am mistaken: checking if the list was empty additionally would generate extra overhead.
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.
Yes, you're right, it would probably introduce more overhead.
ng_pktsnip_t *pkt = ng_ndp_opt_build(type, sizeof(ng_ndp_opt_t) + l2addr_len, | ||
next); | ||
|
||
if (pkt == NULL) { |
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.
if (pkt != NULL) ...
here, too.
If comments are adressed: ACK |
9f583e5
to
6df82b9
Compare
Rebased to current master and squashed |
(and addressed rest of the comments) |
6df82b9
to
db33a10
Compare
Just a little fix so the unittests would still compile |
What happened to static routing? If I add 2001:db8::1/64 to an interface, there should be some static routing entry, and RIOT should use ndp to find the link local address. No need for a routing protocol or router discovery here? |
@kaspar030 if you compile with the FIB and you add an entry to the FIB it will be able to route to this entry, so yes: static routing is possible. |
ng_ndp: initial import of address resolution
ng_ipv6_addr_t dst; | ||
|
||
DEBUG("ndp: Retransmit neighbor solicitation for %s\n", | ||
ng_ipv6_addr_to_str(addr_str, nc_entry->ipv6_addr, sizeof(addr_str))); |
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.
addr_str
is not defined, i.e. array is missing
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.
2nd argument needs to be a pointer. Here and some lines below
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.
See #3036
This imports address resolution and neighbor unreachable discovery for IPv6.
Depends on
#2908(merged),#2909(merged) and#2964(merged).