diff options
| author | Antoine Tenart <atenart@kernel.org> | 2025-09-15 11:19:55 +0200 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2025-09-19 17:35:51 -0700 |
| commit | dcc0e68ed300dae3325e323417773dd59a6a65db (patch) | |
| tree | 894a55235f3a71654e43d5ecdcd41177dc4646cc /net/ipv4 | |
| parent | net: ipv4: make udp_v4_early_demux explicitly return drop reason (diff) | |
| download | linux-dcc0e68ed300dae3325e323417773dd59a6a65db.tar.gz linux-dcc0e68ed300dae3325e323417773dd59a6a65db.zip | |
net: ipv4: simplify drop reason handling in ip_rcv_finish_core
Instead of setting the drop reason to SKB_DROP_REASON_NOT_SPECIFIED
early and having to reset it each time it is overridden by a function
returned value, just set the drop reason to the expected value before
returning from ip_rcv_finish_core.
Signed-off-by: Antoine Tenart <atenart@kernel.org>
Link: https://patch.msgid.link/20250915091958.15382-3-atenart@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv4')
| -rw-r--r-- | net/ipv4/ip_input.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 8878e865ddf6..93b8286e526a 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -335,7 +335,6 @@ static int ip_rcv_finish_core(struct net *net, goto drop_error; } - drop_reason = SKB_DROP_REASON_NOT_SPECIFIED; if (READ_ONCE(net->ipv4.sysctl_ip_early_demux) && !skb_dst(skb) && !skb->sk && @@ -354,7 +353,6 @@ static int ip_rcv_finish_core(struct net *net, drop_reason = udp_v4_early_demux(skb); if (unlikely(drop_reason)) goto drop_error; - drop_reason = SKB_DROP_REASON_NOT_SPECIFIED; /* must reload iph, skb->head might have changed */ iph = ip_hdr(skb); @@ -372,7 +370,6 @@ static int ip_rcv_finish_core(struct net *net, ip4h_dscp(iph), dev); if (unlikely(drop_reason)) goto drop_error; - drop_reason = SKB_DROP_REASON_NOT_SPECIFIED; } else { struct in_device *in_dev = __in_dev_get_rcu(dev); @@ -391,8 +388,10 @@ static int ip_rcv_finish_core(struct net *net, } #endif - if (iph->ihl > 5 && ip_rcv_options(skb, dev)) + if (iph->ihl > 5 && ip_rcv_options(skb, dev)) { + drop_reason = SKB_DROP_REASON_NOT_SPECIFIED; goto drop; + } rt = skb_rtable(skb); if (rt->rt_type == RTN_MULTICAST) { |
