-
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
sys/net/network_layer added a core implementation of a FIB #2211
Conversation
Wouldn't |
* @return FIB_SUCCESS on success | ||
* FIB_ERROR if the entry cannot be created due to unsufficient RAM | ||
*/ | ||
int fib_table_add_entry(uint8_t iface_id, uint8_t *glob_dst, size_t glob_dst_size, uint8_t *next_hop, size_t next_hop_size, uint32_t lifetime); |
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.
Didn't we talk about this previously, to use kernel_pid_t
as type for iface_id
?
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.
Yeah it was an attempt to save a byte for each entry.
I change it :)
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.
done.
Hmm don't know, its more forwarding than routing |
873c9bb
to
e7b924f
Compare
actually I think network layer is the correct place for this module. |
I think it's pretty arbitrary, since the network layer uses it to find the next hop and routing (which is more or less part of the network layer) is filling it. |
@BytesGalore, @authmillenon: does it makes sense to convert the test application into a unit test? |
@haukepetersen definitely. I will migrate the tests this afternoon/tomorrow morning |
nice! |
While researching for IPv6's neighbor cache I stumbled upon the data structure Destination Cache which is pretty similar (or probably the same thing, just another term for) the FIB, except that it is suggested to store things like path MTU or round-trip timers. Do we want to add such things to the FIB
|
No. Keep the FIB as simple as possible. And from what I read this destination cache is quite different from a FIB (e.g., it includes off-link destinations, too). |
Usually I wouldn't expect to ask the FIB for the PMTU, or other path specific information directly. But this is just my individual opinion and does not take IPv6 capabilities of RIOT into account. [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/net/ip6_fib.h |
I fully agree with @BytesGalore here. |
If you rebase, I start reviewing this, since I come to the point, were I need it in IPv6 :D |
@@ -73,6 +73,10 @@ ifneq (,$(filter oneway_malloc,$(USEMODULE))) | |||
USEMODULE_INCLUDES += $(RIOTBASE)/sys/oneway-malloc/include | |||
endif | |||
|
|||
ifneq (,$(filter fib,$(USEMODULE))) | |||
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include |
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.
move fib/fib.h
to sys/include/net/ng_fib.h
and all its sub-headers to sys/include/net/ng_fib/
and remove this line to make this part of NTSF.
#define UNIVERSAL_ADDRESS_SIZE (16) /**< size of the used addresses in bytes */ | ||
#define UNIVERSAL_ADDRESS_SUCCESS (0) /**< return value for success */ | ||
#define UNIVERSAL_ADDRESS_ERROR_MEMORY (-1) /**< error value for invalid output buffer size */ | ||
#define UNIVERSAL_ADDRESS_NO_HIT (-2) /**< value for a address compare failed */ |
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.
-ENOENT
?
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.
ok changed that
Apart from my issue with |
* NULL if the size is unsufficient for copy | ||
*/ | ||
uint8_t* universal_address_get_address(universal_address_container_t *entry, | ||
uint8_t *addr, size_t *addr_size); |
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.
indentation
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.
done this
So you did not consider to move |
ah sorry I did that but forgot to commit the changes 😊 |
squashed |
ACK when Travis is happy :) |
To make travis happy I need to suppress a cppcheck warning due to a buffer I reuse in a unittest twice. |
memset(addr_nxt, 0, add_buf_size); | ||
memset(addr_lookup, 0, add_buf_size); | ||
|
||
/* cppcheck: addr_lookup is only passed but not required to be read */ |
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.
s# \*/$#since we test prefix matching \*/#
?
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.
done
Re-ACK, please squash. |
re-squashed |
Waiting for Travis… |
memset(addr_nxt, 0, add_buf_size); | ||
memset(addr_lookup, 0, add_buf_size); | ||
|
||
/* cppcheck: addr_lookup is only passed but not required to be read, |
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.
s/ \+$//
;-)
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.
done and squashed since the change will not destroy anything (hopefully)
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.
(please squash immediately to speed things up ;-))
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.
There is still a whitespace at the end.
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.
I think github tricks us, inspecting the file in raw shows the whitespace is gone :)
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.
You're right... Travis just passed this test.
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.
hurray :)
And go \o/ |
sys/net/network_layer added a core implementation of a FIB
Woohooo 😄 |
This PR introduces a Forwarding Information Base (FIB) implementation.
It will replace the
ip_get_next_hop()
call on registered functions from routing protocols (RPs), e.g. here.universal address container
that allows to use one added entry multiple times.