* Return value of 1, the TCB is unlocked and most * likely gone, return value of 0, the TCP is still * locked. */
| 9693 | * locked. |
| 9694 | */ |
| 9695 | static int |
| 9696 | rack_do_close_wait(struct mbuf *m, struct tcphdr *th, struct socket *so, |
| 9697 | struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, |
| 9698 | uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos) |
| 9699 | { |
| 9700 | int32_t ret_val = 0; |
| 9701 | |
| 9702 | ctf_calc_rwin(so, tp); |
| 9703 | if ((thflags & TH_RST) || |
| 9704 | (tp->t_fin_is_rst && (thflags & TH_FIN))) |
| 9705 | return (ctf_process_rst(m, th, so, tp)); |
| 9706 | /* |
| 9707 | * RFC5961 Section 4.2 Send challenge ACK for any SYN in |
| 9708 | * synchronized state. |
| 9709 | */ |
| 9710 | if (thflags & TH_SYN) { |
| 9711 | ctf_challenge_ack(m, th, tp, &ret_val); |
| 9712 | return (ret_val); |
| 9713 | } |
| 9714 | /* |
| 9715 | * RFC 1323 PAWS: If we have a timestamp reply on this segment and |
| 9716 | * it's less than ts_recent, drop it. |
| 9717 | */ |
| 9718 | if ((to->to_flags & TOF_TS) != 0 && tp->ts_recent && |
| 9719 | TSTMP_LT(to->to_tsval, tp->ts_recent)) { |
| 9720 | if (ctf_ts_check(m, th, tp, tlen, thflags, &ret_val)) |
| 9721 | return (ret_val); |
| 9722 | } |
| 9723 | if (ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val)) { |
| 9724 | return (ret_val); |
| 9725 | } |
| 9726 | /* |
| 9727 | * If last ACK falls within this segment's sequence numbers, record |
| 9728 | * its timestamp. NOTE: 1) That the test incorporates suggestions |
| 9729 | * from the latest proposal of the tcplw@cray.com list (Braden |
| 9730 | * 1993/04/26). 2) That updating only on newer timestamps interferes |
| 9731 | * with our earlier PAWS tests, so this check should be solely |
| 9732 | * predicated on the sequence space of this segment. 3) That we |
| 9733 | * modify the segment boundary check to be Last.ACK.Sent <= SEG.SEQ |
| 9734 | * + SEG.Len instead of RFC1323's Last.ACK.Sent < SEG.SEQ + |
| 9735 | * SEG.Len, This modified check allows us to overcome RFC1323's |
| 9736 | * limitations as described in Stevens TCP/IP Illustrated Vol. 2 |
| 9737 | * p.869. In such cases, we can still calculate the RTT correctly |
| 9738 | * when RCV.NXT == Last.ACK.Sent. |
| 9739 | */ |
| 9740 | if ((to->to_flags & TOF_TS) != 0 && |
| 9741 | SEQ_LEQ(th->th_seq, tp->last_ack_sent) && |
| 9742 | SEQ_LEQ(tp->last_ack_sent, th->th_seq + tlen + |
| 9743 | ((thflags & (TH_SYN | TH_FIN)) != 0))) { |
| 9744 | tp->ts_recent_age = tcp_ts_getticks(); |
| 9745 | tp->ts_recent = to->to_tsval; |
| 9746 | } |
| 9747 | /* |
| 9748 | * If the ACK bit is off: if in SYN-RECEIVED state or SENDSYN flag |
| 9749 | * is on (half-synchronized state), then queue data for later |
| 9750 | * processing; else drop segment and return. |
| 9751 | */ |
| 9752 | if ((thflags & TH_ACK) == 0) { |
nothing calls this directly
no test coverage detected