summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2017-09-20 18:26:53 +0200
committerDavid S. Miller <davem@davemloft.net>2017-09-21 15:15:22 -0700
commit6e617de84e87d626d1e976fc30e1322239fd4d2d (patch)
tree1bbc7e3a49f22574422489dd654f9e3668fe6e41 /drivers/net/dsa
parenta99855d1598be17d3da618234daab5cbc49afb07 (diff)
downloadtalos-op-linux-6e617de84e87d626d1e976fc30e1322239fd4d2d.tar.gz
talos-op-linux-6e617de84e87d626d1e976fc30e1322239fd4d2d.zip
net: avoid a full fib lookup when rp_filter is disabled.
Since commit 1dced6a85482 ("ipv4: Restore accept_local behaviour in fib_validate_source()") a full fib lookup is needed even if the rp_filter is disabled, if accept_local is false - which is the default. What we really need in the above scenario is just checking that the source IP address is not local, and in most case we can do that is a cheaper way looking up the ifaddr hash table. This commit adds a helper for such lookup, and uses it to validate the src address when rp_filter is disabled and no 'local' routes are created by the user space in the relevant namespace. A new ipv4 netns flag is added to account for such routes. We need that to preserve the same behavior we had before this patch. It also drops the checks to bail early from __fib_validate_source, added by the commit 1dced6a85482 ("ipv4: Restore accept_local behaviour in fib_validate_source()") they do not give any measurable performance improvement: if we do the lookup with are on a slower path. This improves UDP performances for unconnected sockets when rp_filter is disabled by 5% and also gives small but measurable performance improvement for TCP flood scenarios. v1 -> v2: - use the ifaddr lookup helper in __ip_dev_find(), as suggested by Eric - fall-back to full lookup if custom local routes are present Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud