]> git.baikalelectronics.ru Git - kernel.git/commit
fib_trie: Provide a deterministic order for fib_alias w/ tables merged
authorAlexander Duyck <alexander.h.duyck@redhat.com>
Thu, 12 Mar 2015 21:46:29 +0000 (14:46 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Mar 2015 22:26:51 +0000 (18:26 -0400)
commit87608c4958a07f540a5b32563fce5c5f95f41ec3
treec3b581a4c65b4e1dcad5f76138c252608c558360
parent65e8d7303dc5b7567a5a9b46d9f8ca17da601bb4
fib_trie: Provide a deterministic order for fib_alias w/ tables merged

This change makes it so that we should always have a deterministic ordering
for the main and local aliases within the merged table when two leaves
overlap.

So for example if we have a leaf with a key of 192.168.254.0.  If we
previously added two aliases with a prefix length of 24 from both local and
main the first entry would be first and the second would be second.  When I
was coding this I had added a WARN_ON should such a situation occur as I
wasn't sure how likely it would be.  However this WARN_ON has been
triggered so this is something that should be addressed.

With this patch the ordering of the aliases is as follows.  First they are
sorted on prefix length, then on their table ID, then tos, and finally
priority.  This way what we end up doing is essentially interleaving the
two tables on what used to be leaf_info structure boundaries.

Fixes: ddc9dad41 ("ipv4: FIB Local/MAIN table collapse")
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/fib_trie.c