MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rack_do_established

Function rack_do_established

freebsd/netinet/tcp_stacks/rack.c:9566–9688  ·  view source on GitHub ↗

* Return value of 1, the TCB is unlocked and most * likely gone, return value of 0, the TCP is still * locked. */

Source from the content-addressed store, hash-verified

9564 * locked.
9565 */
9566static int
9567rack_do_established(struct mbuf *m, struct tcphdr *th, struct socket *so,
9568 struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen,
9569 uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos)
9570{
9571 int32_t ret_val = 0;
9572 struct tcp_rack *rack;
9573
9574 /*
9575 * Header prediction: check for the two common cases of a
9576 * uni-directional data xfer. If the packet has no control flags,
9577 * is in-sequence, the window didn't change and we're not
9578 * retransmitting, it's a candidate. If the length is zero and the
9579 * ack moved forward, we're the sender side of the xfer. Just free
9580 * the data acked & wake any higher level process that was blocked
9581 * waiting for space. If the length is non-zero and the ack didn't
9582 * move, we're the receiver side. If we're getting packets in-order
9583 * (the reassembly queue is empty), add the data toc The socket
9584 * buffer and note that we need a delayed ack. Make sure that the
9585 * hidden state-flags are also off. Since we check for
9586 * TCPS_ESTABLISHED first, it can only be TH_NEEDSYN.
9587 */
9588 rack = (struct tcp_rack *)tp->t_fb_ptr;
9589 if (__predict_true(((to->to_flags & TOF_SACK) == 0)) &&
9590 __predict_true((thflags & (TH_SYN | TH_FIN | TH_RST | TH_ACK)) == TH_ACK) &&
9591 __predict_true(SEGQ_EMPTY(tp)) &&
9592 __predict_true(th->th_seq == tp->rcv_nxt)) {
9593 if (tlen == 0) {
9594 if (rack_fastack(m, th, so, tp, to, drop_hdrlen, tlen,
9595 tiwin, nxt_pkt, rack->r_ctl.rc_rcvtime)) {
9596 return (0);
9597 }
9598 } else {
9599 if (rack_do_fastnewdata(m, th, so, tp, to, drop_hdrlen, tlen,
9600 tiwin, nxt_pkt, iptos)) {
9601 return (0);
9602 }
9603 }
9604 }
9605 ctf_calc_rwin(so, tp);
9606
9607 if ((thflags & TH_RST) ||
9608 (tp->t_fin_is_rst && (thflags & TH_FIN)))
9609 return (ctf_process_rst(m, th, so, tp));
9610
9611 /*
9612 * RFC5961 Section 4.2 Send challenge ACK for any SYN in
9613 * synchronized state.
9614 */
9615 if (thflags & TH_SYN) {
9616 ctf_challenge_ack(m, th, tp, &ret_val);
9617 return (ret_val);
9618 }
9619 /*
9620 * RFC 1323 PAWS: If we have a timestamp reply on this segment and
9621 * it's less than ts_recent, drop it.
9622 */
9623 if ((to->to_flags & TOF_TS) != 0 && tp->ts_recent &&

Callers

nothing calls this directly

Calls 15

rack_fastackFunction · 0.85
rack_do_fastnewdataFunction · 0.85
ctf_calc_rwinFunction · 0.85
ctf_process_rstFunction · 0.85
ctf_challenge_ackFunction · 0.85
ctf_ts_checkFunction · 0.85
ctf_drop_checksFunction · 0.85
rack_process_dataFunction · 0.85
ctf_do_dropafterackFunction · 0.85
ctf_do_dropFunction · 0.85
rack_process_ackFunction · 0.85

Tested by

no test coverage detected