* [PATCH net-next] ipv4: raw: check sk->sk_rcvbuf earlier
@ 2024-03-07 16:30 Eric Dumazet
2024-03-07 20:26 ` Willem de Bruijn
2024-03-08 21:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2024-03-07 16:30 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: David Ahern, netdev, eric.dumazet, Eric Dumazet
There is no point cloning an skb and having to free the clone
if the receive queue of the raw socket is full.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv4/raw.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 494a6284bd7ee346a4fca7a161477e6dc5ed5021..42ac434cfcfa677ee58408297f4d3ac05d98b546 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -175,6 +175,13 @@ static int raw_v4_input(struct net *net, struct sk_buff *skb,
if (!raw_v4_match(net, sk, iph->protocol,
iph->saddr, iph->daddr, dif, sdif))
continue;
+
+ if (atomic_read(&sk->sk_rmem_alloc) >=
+ READ_ONCE(sk->sk_rcvbuf)) {
+ atomic_inc(&sk->sk_drops);
+ continue;
+ }
+
delivered = 1;
if ((iph->protocol != IPPROTO_ICMP || !icmp_filter(sk, skb)) &&
ip_mc_sf_allow(sk, iph->daddr, iph->saddr,
--
2.44.0.278.ge034bb2e1d-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ipv4: raw: check sk->sk_rcvbuf earlier
2024-03-07 16:30 [PATCH net-next] ipv4: raw: check sk->sk_rcvbuf earlier Eric Dumazet
@ 2024-03-07 20:26 ` Willem de Bruijn
2024-03-08 21:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2024-03-07 20:26 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: David Ahern, netdev, eric.dumazet, Eric Dumazet
Eric Dumazet wrote:
> There is no point cloning an skb and having to free the clone
> if the receive queue of the raw socket is full.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ipv4: raw: check sk->sk_rcvbuf earlier
2024-03-07 16:30 [PATCH net-next] ipv4: raw: check sk->sk_rcvbuf earlier Eric Dumazet
2024-03-07 20:26 ` Willem de Bruijn
@ 2024-03-08 21:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-08 21:20 UTC (permalink / raw)
To: Eric Dumazet; +Cc: davem, kuba, pabeni, dsahern, netdev, eric.dumazet
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 7 Mar 2024 16:30:20 +0000 you wrote:
> There is no point cloning an skb and having to free the clone
> if the receive queue of the raw socket is full.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> net/ipv4/raw.c | 7 +++++++
> 1 file changed, 7 insertions(+)
Here is the summary with links:
- [net-next] ipv4: raw: check sk->sk_rcvbuf earlier
https://git.kernel.org/netdev/net-next/c/d721812aa875
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-08 21:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-07 16:30 [PATCH net-next] ipv4: raw: check sk->sk_rcvbuf earlier Eric Dumazet
2024-03-07 20:26 ` Willem de Bruijn
2024-03-08 21:20 ` patchwork-bot+netdevbpf
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).