-
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
net/fib: Added network prefix flag to indicate a network destination #3157
Conversation
5c161d3
to
9d5fced
Compare
9d5fced
to
399dfe2
Compare
@BytesGalore please rebase |
399dfe2
to
26c93f4
Compare
rebased |
nit-picking: you forgot the net/fib: Added network prefix flag to indicate a networ destination |
travis seems to fail for the mcu groups |
@cgundogan there are probably some |
@@ -60,6 +60,11 @@ typedef struct fib_destination_set_entry_t { | |||
#define FIB_LIFETIME_NO_EXPIRE (0xFFFFFFFF) | |||
|
|||
/** | |||
* @brief flag to identify if the FIB-Entry is a net prefix (MSB == 1) | |||
*/ | |||
#define FIB_FLAG_NET_PREFIX (1<<31) |
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.
(1ul << 31)
or ((uint_32_t)1 << 31)
or (0x80000000ul)
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.
@gebart ah, thanks for clarifying
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 change it to (1ul << 31)
26c93f4
to
5a90bb4
Compare
added the |
@BytesGalore I am currently facing a use case where I would hypothetically want to add a network prefix to the fib. However, just marking the prefix with a flag doesn't seem to be enough. How would it be possible to encode the actual |
@cgundogan right now there is no way to exactly specify the prefix length in bits for a FIB entry :( |
I also thought about this, but what if one or more trailing zeros are part of the network prefix? :/ Going the simple route: Just adding a generic extra byte of information for each entry is the wrong way, is it? |
@cgundogan its maybe the question if we sacrifice one byte of the flags for address specific information, e.g. prefix-length (I'm just thinking loud) |
How many bytes are currently used of the flags entry? 1 out of 4? |
This PR introduces the first seriously used bit in the flags, so 1/8 Byte is in use |
But the lowest byte is set at several calls in the neighbour discovery |
@BytesGalore, could you rebase this again, please? |
5a90bb4
to
01afb92
Compare
sure, rebased :) |
@BytesGalore when I merge this into master then pinging does not work for me on the iotlab testbed with the following setup:
It works on native, however. |
needs a rebase |
01afb92
to
d7069e8
Compare
rebased (whoa strider is green?) |
pinging doesn't seem to work on iotlab-m3 nodes with this PR merged into master |
fad6493
to
1420dde
Compare
@cgundogan I think I fixed the ping issue :D |
@BytesGalore indeed, you fixed it! squash plz (: |
1420dde
to
523d1f8
Compare
squashed |
GO |
net/fib: Added network prefix flag to indicate a network destination
What exactly is the purpose of this flag? |
@OlegHahm the purpose is to set if a given destination is a network or a host prefix. #4279 will supersede this behaviour (which is basically not precise) |
I still don't understand. If A performs a next-hop lookup in the FIB for B, the lookup finds the longest prefix match for B, right? Hence, the FIB may return C for the best matching address D. Why should A care if D is a prefix or a full host address? |
B: LPM would always return C, but this makes no sense since C is a Host and wouldn't forward to D |
But the lookup should not return the destination field, but the next-hop field of the FIB, right? And this should always contain a host address. |
yes you lookup for the destination address and the returned next-hop is always a host node. |
This PR introduces a specific flag (
FIB_FLAG_NET_PREFIX
) for FIB entries used to indicate if a destination of the entry is a host or a network.edit: The FIB now considers this flag to decide if the given address is a host or network.
So if not set the FIB assumes a host address, even if the address is all (trailing)zeros
::