diff options
author | Guillaume Nault <gnault@redhat.com> | 2024-12-16 18:21:44 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-12-20 13:50:09 -0800 |
commit | 1dbdce30f040a87f5aa6a9dbe43be398737f090f (patch) | |
tree | c171045b99d5d3940b8635e974a32f25867511a2 /tools/testing/selftests/net/lib/py/utils.py | |
parent | 6ed3472173c575cd8aaed6c62eb74f7728404ee6 (diff) | |
download | linux-1dbdce30f040a87f5aa6a9dbe43be398737f090f.tar.gz linux-1dbdce30f040a87f5aa6a9dbe43be398737f090f.tar.bz2 linux-1dbdce30f040a87f5aa6a9dbe43be398737f090f.zip |
ipv4: Define inet_sk_init_flowi4() and use it in inet_sk_rebuild_header().
IPv4 code commonly has to initialise a flowi4 structure from an IPv4
socket. This requires looking at potential IPv4 options to set the
proper destination address, call flowi4_init_output() with the correct
set of parameters and run the sk_classify_flow security hook.
Instead of reimplementing these operations in different parts of the
stack, let's define inet_sk_init_flowi4() which does all these
operations.
The first user is inet_sk_rebuild_header(), where inet_sk_init_flowi4()
replaces ip_route_output_ports(). Unlike ip_route_output_ports(), which
sets the flowi4 structure and performs the route lookup in one go,
inet_sk_init_flowi4() only initialises the flow. The route lookup is
then done by ip_route_output_flow(). Decoupling flow initialisation
from route lookup makes this new interface applicable more broadly as
it will allow some users to overwrite specific struct flowi4 members
before the route lookup.
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Link: https://patch.msgid.link/fd416275262b1f518d5abfcef740ce4f4a1a6522.1734357769.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/lib/py/utils.py')
0 files changed, 0 insertions, 0 deletions