]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ipv4: Convert ip_route_input() to dscp_t.
authorGuillaume Nault <gnault@redhat.com>
Tue, 1 Oct 2024 19:28:43 +0000 (21:28 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Oct 2024 23:21:21 +0000 (16:21 -0700)
commit7e863e5db6185b1add0df4cb01b31a4ed1c4b738
tree27371cdd8ec64b356740dcf2ba72ed3bee1f8aca
parent913c83a610bb7dd8e5952a2b4663e1feec0b5de6
ipv4: Convert ip_route_input() to dscp_t.

Pass a dscp_t variable to ip_route_input(), instead of a plain u8, to
prevent accidental setting of ECN bits in ->flowi4_tos.

Callers of ip_route_input() to consider are:

  * input_action_end_dx4_finish() and input_action_end_dt4() in
    net/ipv6/seg6_local.c. These functions set the tos parameter to 0,
    which is already a valid dscp_t value, so they don't need to be
    adjusted for the new prototype.

  * icmp_route_lookup(), which already has a dscp_t variable to pass as
    parameter. We just need to remove the inet_dscp_to_dsfield()
    conversion.

  * br_nf_pre_routing_finish(), ip_options_rcv_srr() and ip4ip6_err(),
    which get the DSCP directly from IPv4 headers. Define a helper to
    read the .tos field of struct iphdr as dscp_t, so that these
    function don't have to do the conversion manually.

While there, declare *iph as const in br_nf_pre_routing_finish(),
declare its local variables in reverse-christmas-tree order and move
the "err = ip_route_input()" assignment out of the conditional to avoid
checkpatch warning.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/e9d40781d64d3d69f4c79ac8a008b8d67a033e8d.1727807926.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/ip.h
include/net/route.h
net/bridge/br_netfilter_hooks.c
net/ipv4/icmp.c
net/ipv4/ip_options.c
net/ipv6/ip6_tunnel.c