From: Guillaume Nault <gnault@redhat.com>
To: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Subject: [PATCH net-next 4/7] ipv4: Convert ip_route_input_mc() to dscp_t.
Date: Mon, 7 Oct 2024 20:24:48 +0200 [thread overview]
Message-ID: <0cc653ef59bbc0a28881f706d34896c61eba9e01.1728302212.git.gnault@redhat.com> (raw)
In-Reply-To: <cover.1728302212.git.gnault@redhat.com>
Pass a dscp_t variable to ip_route_input_mc(), instead of a plain u8,
to prevent accidental setting of ECN bits in ->flowi4_tos.
Only ip_route_input_rcu() actually calls ip_route_input_mc(). Since it
already has a dscp_t variable to pass as parameter, we only need to
remove the inet_dscp_to_dsfield() conversion.
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
net/ipv4/route.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 763b8bafd1bf..527121be1ba2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1697,7 +1697,7 @@ int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
/* called in rcu_read_lock() section */
static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
- u8 tos, struct net_device *dev, int our)
+ dscp_t dscp, struct net_device *dev, int our)
{
struct in_device *in_dev = __in_dev_get_rcu(dev);
unsigned int flags = RTCF_MULTICAST;
@@ -1705,7 +1705,9 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u32 itag = 0;
int err;
- err = ip_mc_validate_source(skb, daddr, saddr, tos, dev, in_dev, &itag);
+ err = ip_mc_validate_source(skb, daddr, saddr,
+ inet_dscp_to_dsfield(dscp), dev, in_dev,
+ &itag);
if (err)
return err;
@@ -2455,9 +2457,8 @@ static int ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr,
IN_DEV_MFORWARD(in_dev))
#endif
) {
- err = ip_route_input_mc(skb, daddr, saddr,
- inet_dscp_to_dsfield(dscp),
- dev, our);
+ err = ip_route_input_mc(skb, daddr, saddr, dscp, dev,
+ our);
}
return err;
}
--
2.39.2
next prev parent reply other threads:[~2024-10-07 18:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-07 18:24 [PATCH net-next 0/7] ipv4: Convert __fib_validate_source() and its callers to dscp_t Guillaume Nault
2024-10-07 18:24 ` [PATCH net-next 1/7] ipv4: Convert ip_route_use_hint() " Guillaume Nault
2024-10-07 18:24 ` [PATCH net-next 2/7] ipv4: Convert ip_mkroute_input() " Guillaume Nault
2024-10-07 18:24 ` [PATCH net-next 3/7] ipv4: Convert __mkroute_input() " Guillaume Nault
2024-10-07 18:24 ` Guillaume Nault [this message]
2024-10-07 18:24 ` [PATCH net-next 5/7] ipv4: Convert ip_mc_validate_source() " Guillaume Nault
2024-10-07 18:25 ` [PATCH net-next 6/7] ipv4: Convert fib_validate_source() " Guillaume Nault
2024-10-07 18:25 ` [PATCH net-next 7/7] ipv4: Convert __fib_validate_source() " Guillaume Nault
2024-10-08 8:37 ` [PATCH net-next 0/7] ipv4: Convert __fib_validate_source() and its callers " Ido Schimmel
2024-10-08 14:50 ` David Ahern
2024-10-10 0:40 ` 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=0cc653ef59bbc0a28881f706d34896c61eba9e01.1728302212.git.gnault@redhat.com \
--to=gnault@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).