diff options
author | David Ahern <dsahern@gmail.com> | 2018-02-13 11:11:34 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-13 14:00:57 -0500 |
commit | 0d876f2c6de5b1b00c2fd38bb4f4692e720207b1 (patch) | |
tree | 1b6dfe55bd2c69fc829d524354ca575d96ea64fe | |
parent | 3174a944761d70e466444e81d5a3b80247596568 (diff) |
net/ipv4: Simplify fib_select_path
If flow oif is set and it is not an l3mdev, then fib_select_path
can jump to the source address check.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/fib_semantics.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index c586597da20d..0b8c0a719f3e 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1760,13 +1760,11 @@ void fib_select_multipath(struct fib_result *res, int hash) | |||
1760 | void fib_select_path(struct net *net, struct fib_result *res, | 1760 | void fib_select_path(struct net *net, struct fib_result *res, |
1761 | struct flowi4 *fl4, const struct sk_buff *skb) | 1761 | struct flowi4 *fl4, const struct sk_buff *skb) |
1762 | { | 1762 | { |
1763 | bool oif_check; | 1763 | if (fl4->flowi4_oif && !(fl4->flowi4_flags & FLOWI_FLAG_SKIP_NH_OIF)) |
1764 | 1764 | goto check_saddr; | |
1765 | oif_check = (fl4->flowi4_oif == 0 || | ||
1766 | fl4->flowi4_flags & FLOWI_FLAG_SKIP_NH_OIF); | ||
1767 | 1765 | ||
1768 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 1766 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
1769 | if (res->fi->fib_nhs > 1 && oif_check) { | 1767 | if (res->fi->fib_nhs > 1) { |
1770 | int h = fib_multipath_hash(res->fi, fl4, skb); | 1768 | int h = fib_multipath_hash(res->fi, fl4, skb); |
1771 | 1769 | ||
1772 | fib_select_multipath(res, h); | 1770 | fib_select_multipath(res, h); |
@@ -1775,9 +1773,10 @@ void fib_select_path(struct net *net, struct fib_result *res, | |||
1775 | #endif | 1773 | #endif |
1776 | if (!res->prefixlen && | 1774 | if (!res->prefixlen && |
1777 | res->table->tb_num_default > 1 && | 1775 | res->table->tb_num_default > 1 && |
1778 | res->type == RTN_UNICAST && oif_check) | 1776 | res->type == RTN_UNICAST) |
1779 | fib_select_default(fl4, res); | 1777 | fib_select_default(fl4, res); |
1780 | 1778 | ||
1779 | check_saddr: | ||
1781 | if (!fl4->saddr) | 1780 | if (!fl4->saddr) |
1782 | fl4->saddr = FIB_RES_PREFSRC(net, *res); | 1781 | fl4->saddr = FIB_RES_PREFSRC(net, *res); |
1783 | } | 1782 | } |