[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250918083127.41147-4-atenart@kernel.org>
Date: Thu, 18 Sep 2025 10:31:16 +0200
From: Antoine Tenart <atenart@...nel.org>
To: davem@...emloft.net,
kuba@...nel.org,
pabeni@...hat.com,
edumazet@...gle.com,
dsahern@...nel.org
Cc: Antoine Tenart <atenart@...nel.org>,
netdev@...r.kernel.org
Subject: [PATCH net-next v2 3/4] net: ipv4: use the right type for drop reasons in ip_rcv_finish_core
Make drop reasons be `enum skb_drop_reason` instead of `int`. While at
it make the SKB_NOT_DROPPED_YET checks explicit.
Suggested-by: David Ahern <dsahern@...nel.org>
Signed-off-by: Antoine Tenart <atenart@...nel.org>
---
net/ipv4/ip_input.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 93b8286e526a..229c7e6b7e4c 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -325,13 +325,13 @@ static int ip_rcv_finish_core(struct net *net,
const struct sk_buff *hint)
{
const struct iphdr *iph = ip_hdr(skb);
+ enum skb_drop_reason drop_reason;
struct rtable *rt;
- int drop_reason;
if (ip_can_use_hint(skb, iph, hint)) {
drop_reason = ip_route_use_hint(skb, iph->daddr, iph->saddr,
ip4h_dscp(iph), dev, hint);
- if (unlikely(drop_reason))
+ if (unlikely(drop_reason != SKB_NOT_DROPPED_YET))
goto drop_error;
}
@@ -351,7 +351,7 @@ static int ip_rcv_finish_core(struct net *net,
case IPPROTO_UDP:
if (READ_ONCE(net->ipv4.sysctl_udp_early_demux)) {
drop_reason = udp_v4_early_demux(skb);
- if (unlikely(drop_reason))
+ if (unlikely(drop_reason != SKB_NOT_DROPPED_YET))
goto drop_error;
/* must reload iph, skb->head might have changed */
@@ -368,7 +368,7 @@ static int ip_rcv_finish_core(struct net *net,
if (!skb_valid_dst(skb)) {
drop_reason = ip_route_input_noref(skb, iph->daddr, iph->saddr,
ip4h_dscp(iph), dev);
- if (unlikely(drop_reason))
+ if (unlikely(drop_reason != SKB_NOT_DROPPED_YET))
goto drop_error;
} else {
struct in_device *in_dev = __in_dev_get_rcu(dev);
--
2.51.0
Powered by blists - more mailing lists