Commit 659affdb authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: add drop reasons to tcp_rcv_synsent_state_process()

Re-use existing reasons.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c337578a
...@@ -6144,6 +6144,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, ...@@ -6144,6 +6144,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
struct tcp_fastopen_cookie foc = { .len = -1 }; struct tcp_fastopen_cookie foc = { .len = -1 };
int saved_clamp = tp->rx_opt.mss_clamp; int saved_clamp = tp->rx_opt.mss_clamp;
bool fastopen_fail; bool fastopen_fail;
SKB_DR(reason);
tcp_parse_options(sock_net(sk), skb, &tp->rx_opt, 0, &foc); tcp_parse_options(sock_net(sk), skb, &tp->rx_opt, 0, &foc);
if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
...@@ -6198,9 +6199,10 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, ...@@ -6198,9 +6199,10 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
* See note below! * See note below!
* --ANK(990513) * --ANK(990513)
*/ */
if (!th->syn) if (!th->syn) {
SKB_DR_SET(reason, TCP_FLAGS);
goto discard_and_undo; goto discard_and_undo;
}
/* rfc793: /* rfc793:
* "If the SYN bit is on ... * "If the SYN bit is on ...
* are acceptable then ... * are acceptable then ...
...@@ -6291,15 +6293,16 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, ...@@ -6291,15 +6293,16 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
* *
* Otherwise (no ACK) drop the segment and return." * Otherwise (no ACK) drop the segment and return."
*/ */
SKB_DR_SET(reason, TCP_RESET);
goto discard_and_undo; goto discard_and_undo;
} }
/* PAWS check. */ /* PAWS check. */
if (tp->rx_opt.ts_recent_stamp && tp->rx_opt.saw_tstamp && if (tp->rx_opt.ts_recent_stamp && tp->rx_opt.saw_tstamp &&
tcp_paws_reject(&tp->rx_opt, 0)) tcp_paws_reject(&tp->rx_opt, 0)) {
SKB_DR_SET(reason, TCP_RFC7323_PAWS);
goto discard_and_undo; goto discard_and_undo;
}
if (th->syn) { if (th->syn) {
/* We see SYN without ACK. It is attempt of /* We see SYN without ACK. It is attempt of
* simultaneous connect with crossed SYNs. * simultaneous connect with crossed SYNs.
...@@ -6358,7 +6361,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, ...@@ -6358,7 +6361,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
discard_and_undo: discard_and_undo:
tcp_clear_options(&tp->rx_opt); tcp_clear_options(&tp->rx_opt);
tp->rx_opt.mss_clamp = saved_clamp; tp->rx_opt.mss_clamp = saved_clamp;
tcp_drop(sk, skb); tcp_drop_reason(sk, skb, reason);
return 0; return 0;
reset_and_undo: reset_and_undo:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment