tp->ecn_flags &= ~TE_SENDIPECT;
}
- soisconnected(so);
#if CONFIG_MACF_NET && CONFIG_MACF_SOCKET
/* XXXMAC: recursive lock: SOCK_LOCK(so); */
mac_socketpeer_label_associate_mbuf(m, so);
tp->t_state = TCPS_ESTABLISHED;
tp->t_timer[TCPT_KEEP] = TCP_KEEPIDLE(tp);
}
+ /* soisconnected may lead to socket_unlock in case of upcalls,
+ * make sure this is done when everything is setup.
+ */
+ soisconnected(so);
} else {
/*
* Received initial SYN in SYN-SENT[*] state => simul-
case TCPS_SYN_RECEIVED:
tcpstat.tcps_connects++;
- soisconnected(so);
/* Do window scaling? */
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
(void) tcp_reass(tp, (struct tcphdr *)0, &tlen,
(struct mbuf *)0);
tp->snd_wl1 = th->th_seq - 1;
+
/* FALLTHROUGH */
+ /* soisconnected may lead to socket_unlock in case of upcalls,
+ * make sure this is done when everything is setup.
+ */
+ soisconnected(so);
+
/*
* In ESTABLISHED state: drop duplicate ACKs; ACK out of range
* ACKs. If the ack is in the range
tp->snd_wnd -= acked;
ourfinisacked = 0;
}
- sowwakeup(so);
/* detect una wraparound */
if ((tcp_do_newreno || tp->sack_enable) &&
!IN_FASTRECOVERY(tp) &&
}
if (SEQ_LT(tp->snd_nxt, tp->snd_una))
tp->snd_nxt = tp->snd_una;
+
+ /*
+ * sowwakeup must happen after snd_una, et al. are updated so that
+ * the sequence numbers are in sync with so_snd
+ */
+ sowwakeup(so);
switch (tp->t_state) {
* we'll hang forever.
*/
if (so->so_state & SS_CANTRCVMORE) {
- soisdisconnected(so);
tp->t_timer[TCPT_2MSL] = tcp_maxidle;
add_to_time_wait(tp);
+ soisdisconnected(so);
}
tp->t_state = TCPS_FIN_WAIT_2;
goto drop;
tp->snd_ssthresh = max(2 * mss, rt->rt_rmx.rmx_ssthresh);
tcpstat.tcps_usedssthresh++;
}
+ else
+ tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT;
+
lck_mtx_unlock(rt_mtx);
}