[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <67a55b76da19a_25109e294ee@willemb.c.googlers.com.notmuch>
Date: Thu, 06 Feb 2025 20:01:42 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
netdev@...r.kernel.org
Cc: davem@...emloft.net,
kuba@...nel.org,
edumazet@...gle.com,
pabeni@...hat.com,
Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather
than updating inet_sk
Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@...gle.com>
>
> Do not modify socket fields if it can be avoided.
>
> The current code predates the introduction of ip cookies in commit
> aa6615814533 ("ipv4: processing ancillary IP_TOS or IP_TTL"). Now that
> cookies exist and support tos, update that field directly.
>
> Signed-off-by: Willem de Bruijn <willemb@...gle.com>
>
> ---
>
> Tested with ping -Q 32 127.0.0.1 and tcpdump
>
> The existing logic works because inet->tos is read if ipc.tos (and
> with that cork->tos) is left unitialized:
>
> iph->tos = (cork->tos != -1) ? cork->tos : READ_ONCE(inet->tos);
> ---
> net/ipv4/icmp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
> index 094084b61bff..9c5e052a7802 100644
> --- a/net/ipv4/icmp.c
> +++ b/net/ipv4/icmp.c
> @@ -429,7 +429,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
> icmp_param->data.icmph.checksum = 0;
>
> ipcm_init(&ipc);
> - inet->tos = ip_hdr(skb)->tos;
> + ipc.tos = ip_hdr(skb)->tos;
> ipc.sockc.mark = mark;
> daddr = ipc.addr = ip_hdr(skb)->saddr;
> saddr = fib_compute_spec_dst(skb);
local variable inet is no longer used, needs to be removed.
Will fix in v2.
Powered by blists - more mailing lists