BPF List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@google.com>, <gnault@redhat.com>, <dsahern@kernel.org>,
	<fw@strlen.de>, <martin.lau@linux.dev>, <daniel@iogearbox.net>,
	<john.fastabend@gmail.com>, <ast@kernel.org>,
	<pablo@netfilter.org>, <kadlec@netfilter.org>,
	<willemdebruijn.kernel@gmail.com>, <bpf@vger.kernel.org>,
	<netfilter-devel@vger.kernel.org>, <coreteam@netfilter.org>,
	Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 07/12] ipv4: Unmask upper DSCP bits in fib_compute_spec_dst()
Date: Wed, 21 Aug 2024 15:52:46 +0300	[thread overview]
Message-ID: <20240821125251.1571445-8-idosch@nvidia.com> (raw)
In-Reply-To: <20240821125251.1571445-1-idosch@nvidia.com>

As explained in commit 35ebf65e851c ("ipv4: Create and use
fib_compute_spec_dst() helper."), the function is used - for example -
to determine the source address for an ICMP reply. If we are responding
to a multicast or broadcast packet, the source address is set to the
source address that we would use if we were to send a packet to the
unicast source of the original packet. This address is determined by
performing a FIB lookup and using the preferred source address of the
resulting route.

Unmask the upper DSCP bits of the DS field of the packet that triggered
the reply so that in the future the FIB lookup could be performed
according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when
comparing against the TOS selectors in FIB rules and routes.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 net/ipv4/fib_frontend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 8b740f575da1..793e6781399a 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -293,7 +293,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb)
 			.flowi4_iif = LOOPBACK_IFINDEX,
 			.flowi4_l3mdev = l3mdev_master_ifindex_rcu(dev),
 			.daddr = ip_hdr(skb)->saddr,
-			.flowi4_tos = ip_hdr(skb)->tos & IPTOS_RT_MASK,
+			.flowi4_tos = ip_hdr(skb)->tos & INET_DSCP_MASK,
 			.flowi4_scope = scope,
 			.flowi4_mark = vmark ? skb->mark : 0,
 		};
-- 
2.46.0


  parent reply	other threads:[~2024-08-21 12:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21 12:52 [PATCH net-next 00/12] Unmask upper DSCP bits - part 1 Ido Schimmel
2024-08-21 12:52 ` [PATCH net-next 01/12] bpf: Unmask upper DSCP bits in bpf_fib_lookup() helper Ido Schimmel
2024-08-21 14:35   ` Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 02/12] ipv4: Unmask upper DSCP bits in NETLINK_FIB_LOOKUP family Ido Schimmel
2024-08-21 14:37   ` Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 03/12] ipv4: Unmask upper DSCP bits when constructing the Record Route option Ido Schimmel
2024-08-21 14:46   ` Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 04/12] netfilter: rpfilter: Unmask upper DSCP bits Ido Schimmel
2024-08-21 14:50   ` Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 05/12] netfilter: nft_fib: " Ido Schimmel
2024-08-21 14:53   ` Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 06/12] ipv4: ipmr: Unmask upper DSCP bits in ipmr_rt_fib_lookup() Ido Schimmel
2024-08-21 15:05   ` Guillaume Nault
2024-08-21 12:52 ` Ido Schimmel [this message]
2024-08-21 15:06   ` [PATCH net-next 07/12] ipv4: Unmask upper DSCP bits in fib_compute_spec_dst() Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 08/12] ipv4: Unmask upper DSCP bits in input route lookup Ido Schimmel
2024-08-21 16:28   ` Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 09/12] ipv4: Unmask upper DSCP bits in RTM_GETROUTE " Ido Schimmel
2024-08-21 16:30   ` Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 10/12] ipv4: icmp: Pass full DS field to ip_route_input() Ido Schimmel
2024-08-21 16:44   ` Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 11/12] ipv4: udp: Unmask upper DSCP bits during early demux Ido Schimmel
2024-08-21 16:46   ` Guillaume Nault
2024-08-21 12:52 ` [PATCH net-next 12/12] ipv4: Unmask upper DSCP bits when using hints Ido Schimmel
2024-08-21 16:50   ` Guillaume Nault
2024-08-21 14:48 ` [PATCH net-next 00/12] Unmask upper DSCP bits - part 1 Florian Westphal
2024-08-21 17:00 ` David Ahern
2024-08-23  0:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240821125251.1571445-8-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=coreteam@netfilter.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=gnault@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox