mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
3424291dd2
commit
e34100c2ec
5 changed files with 9 additions and 7 deletions
|
@ -392,7 +392,7 @@ enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
|
||||||
u32 *tw_isn);
|
u32 *tw_isn);
|
||||||
struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
|
struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
|
||||||
struct request_sock *req, bool fastopen,
|
struct request_sock *req, bool fastopen,
|
||||||
bool *lost_race);
|
bool *lost_race, enum skb_drop_reason *drop_reason);
|
||||||
enum skb_drop_reason tcp_child_process(struct sock *parent, struct sock *child,
|
enum skb_drop_reason tcp_child_process(struct sock *parent, struct sock *child,
|
||||||
struct sk_buff *skb);
|
struct sk_buff *skb);
|
||||||
void tcp_enter_loss(struct sock *sk);
|
void tcp_enter_loss(struct sock *sk);
|
||||||
|
|
|
@ -6812,10 +6812,9 @@ tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
|
||||||
WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV &&
|
WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV &&
|
||||||
sk->sk_state != TCP_FIN_WAIT1);
|
sk->sk_state != TCP_FIN_WAIT1);
|
||||||
|
|
||||||
if (!tcp_check_req(sk, skb, req, true, &req_stolen)) {
|
SKB_DR_SET(reason, TCP_FASTOPEN);
|
||||||
SKB_DR_SET(reason, TCP_FASTOPEN);
|
if (!tcp_check_req(sk, skb, req, true, &req_stolen, &reason))
|
||||||
goto discard;
|
goto discard;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!th->ack && !th->rst && !th->syn) {
|
if (!th->ack && !th->rst && !th->syn) {
|
||||||
|
|
|
@ -2265,7 +2265,8 @@ lookup:
|
||||||
th = (const struct tcphdr *)skb->data;
|
th = (const struct tcphdr *)skb->data;
|
||||||
iph = ip_hdr(skb);
|
iph = ip_hdr(skb);
|
||||||
tcp_v4_fill_cb(skb, iph, th);
|
tcp_v4_fill_cb(skb, iph, th);
|
||||||
nsk = tcp_check_req(sk, skb, req, false, &req_stolen);
|
nsk = tcp_check_req(sk, skb, req, false, &req_stolen,
|
||||||
|
&drop_reason);
|
||||||
} else {
|
} else {
|
||||||
drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
|
drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -657,7 +657,8 @@ EXPORT_SYMBOL(tcp_create_openreq_child);
|
||||||
|
|
||||||
struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
|
struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
|
||||||
struct request_sock *req,
|
struct request_sock *req,
|
||||||
bool fastopen, bool *req_stolen)
|
bool fastopen, bool *req_stolen,
|
||||||
|
enum skb_drop_reason *drop_reason)
|
||||||
{
|
{
|
||||||
struct tcp_options_received tmp_opt;
|
struct tcp_options_received tmp_opt;
|
||||||
struct sock *child;
|
struct sock *child;
|
||||||
|
|
|
@ -1828,7 +1828,8 @@ lookup:
|
||||||
th = (const struct tcphdr *)skb->data;
|
th = (const struct tcphdr *)skb->data;
|
||||||
hdr = ipv6_hdr(skb);
|
hdr = ipv6_hdr(skb);
|
||||||
tcp_v6_fill_cb(skb, hdr, th);
|
tcp_v6_fill_cb(skb, hdr, th);
|
||||||
nsk = tcp_check_req(sk, skb, req, false, &req_stolen);
|
nsk = tcp_check_req(sk, skb, req, false, &req_stolen,
|
||||||
|
&drop_reason);
|
||||||
} else {
|
} else {
|
||||||
drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
|
drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue