]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: Refactor find_rr_leaf
authorDavid Ahern <dsahern@gmail.com>
Tue, 9 Apr 2019 21:41:15 +0000 (14:41 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Apr 2019 21:24:06 +0000 (14:24 -0700)
commitf8aac3b158c42a88caf8b64c203f5d6ffdbd0040
tree2b79ab7c7809fbc49f17b1d83b0adf9bd625a7b9
parent394364d5a878e501f8a32c9914e8e967ee5e16d5
ipv6: Refactor find_rr_leaf

find_rr_leaf has 3 loops over fib_entries calling find_match. The loops
are very similar with differences in start point and whether the metric
is evaluated:
    1. start at rr_head, no extra loop compare, check fib metric
    2. start at leaf, compare rt against rr_head, check metric
    3. start at cont (potential saved point from earlier loops), no
       extra loop compare, no metric check

Create 1 loop that is called 3 different times. This will make a
later change with multipath nexthop objects much simpler.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/route.c