]> git.kernelconcepts.de Git - karo-tx-linux.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)
commit0b65bd97ba5fc2c43fa4d077e7420f3ec09a40b3
treec3b581a4c65b4e1dcad5f76138c252608c558360
parent3c9e9f7320f0138497ef7879c0903246746e0ed3
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: 0ddcf43d5 ("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