On 01/11/2017 10:48 AM, Eric Dumazet wrote: > On Thu, 2017-01-05 at 16:33 -0500, Jason Baron wrote: > >> >> +/* Accept RST for rcv_nxt - 1 after a FIN. >> + * When tcp connections are abruptly terminated from Mac OSX (via ^C), a >> + * FIN is sent followed by a RST packet. The RST is sent with the same >> + * sequence number as the FIN, and thus according to RFC 5961 a challenge >> + * ACK should be sent. However, Mac OSX does not reply to the challenge ACK >> + * with a RST on the closed socket, hence accept this class of RSTs. >> + */ >> +static bool tcp_reset_check(struct sock *sk, struct sk_buff *skb) > const struct sock *sk, const struct sk_buff *skb > >> +{ >> + struct tcp_sock *tp = tcp_sk(sk); >> + >> + return unlikely((TCP_SKB_CB(skb)->seq == (tp->rcv_nxt - 1)) && >> + (TCP_SKB_CB(skb)->end_seq == (tp->rcv_nxt - 1)) && > Why is the test on end_seq needed ?
Hi, (Re-sending - seems like my reply was lost) I wanted to define this condition as narrowly as I could. I'm ok dropping it - I'm not sure its going to make much difference in practice. So to that end, dropping this extra check makes sense. I posted this as RFC because RFC 5961, I don't think says anything about accepting rcv_nxt - 1 in this case, so I was wondering what people thought... Thanks, -Jason >> + (sk->sk_state == TCP_CLOSE_WAIT || >> + sk->sk_state == TCP_LAST_ACK || >> + sk->sk_state == TCP_CLOSING)); >> +} > Testing many states can be done more efficiently : > > (1 << sk->sk_state) & (TCPF_CLOSE_WAIT | TCPF_LAST_ACK | > TCPF_CLOSING) > > Thanks >