Skip to content

Commit 0ff8c8b

Browse files
committed
tcp: add a drop_reason pointer to tcp_check_req()
JIRA: https://issues.redhat.com/browse/RHEL-88891 Upstream Status: linux.git commit e34100c Author: Eric Dumazet <edumazet@google.com> Date: Sat Mar 1 20:14:19 2025 +0000 tcp: add a drop_reason pointer to tcp_check_req() We want to add new drop reasons for packets dropped in 3WHS in the following patches. tcp_rcv_state_process() has to set reason to TCP_FASTOPEN, because tcp_check_req() will conditionally overwrite the drop_reason. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Jason Xing <kerneljasonxing@gmail.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://patch.msgid.link/20250301201424.2046477-2-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent c8a75a5 commit 0ff8c8b

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

include/net/tcp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
390390
u32 *tw_isn);
391391
struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
392392
struct request_sock *req, bool fastopen,
393-
bool *lost_race);
393+
bool *lost_race, enum skb_drop_reason *drop_reason);
394394
enum skb_drop_reason tcp_child_process(struct sock *parent, struct sock *child,
395395
struct sk_buff *skb);
396396
void tcp_enter_loss(struct sock *sk);

net/ipv4/tcp_input.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6812,10 +6812,9 @@ tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
68126812
WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV &&
68136813
sk->sk_state != TCP_FIN_WAIT1);
68146814

6815-
if (!tcp_check_req(sk, skb, req, true, &req_stolen)) {
6816-
SKB_DR_SET(reason, TCP_FASTOPEN);
6815+
SKB_DR_SET(reason, TCP_FASTOPEN);
6816+
if (!tcp_check_req(sk, skb, req, true, &req_stolen, &reason))
68176817
goto discard;
6818-
}
68196818
}
68206819

68216820
if (!th->ack && !th->rst && !th->syn) {

net/ipv4/tcp_ipv4.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2268,7 +2268,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
22682268
th = (const struct tcphdr *)skb->data;
22692269
iph = ip_hdr(skb);
22702270
tcp_v4_fill_cb(skb, iph, th);
2271-
nsk = tcp_check_req(sk, skb, req, false, &req_stolen);
2271+
nsk = tcp_check_req(sk, skb, req, false, &req_stolen,
2272+
&drop_reason);
22722273
} else {
22732274
drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
22742275
}

net/ipv4/tcp_minisocks.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,8 @@ EXPORT_SYMBOL(tcp_create_openreq_child);
650650

651651
struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
652652
struct request_sock *req,
653-
bool fastopen, bool *req_stolen)
653+
bool fastopen, bool *req_stolen,
654+
enum skb_drop_reason *drop_reason)
654655
{
655656
struct tcp_options_received tmp_opt;
656657
struct sock *child;

net/ipv6/tcp_ipv6.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,8 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
18291829
th = (const struct tcphdr *)skb->data;
18301830
hdr = ipv6_hdr(skb);
18311831
tcp_v6_fill_cb(skb, hdr, th);
1832-
nsk = tcp_check_req(sk, skb, req, false, &req_stolen);
1832+
nsk = tcp_check_req(sk, skb, req, false, &req_stolen,
1833+
&drop_reason);
18331834
} else {
18341835
drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
18351836
}

0 commit comments

Comments
 (0)