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

Function tcp6_connect

freebsd/netinet/tcp_usrreq.c:1711–1748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1709
1710#ifdef INET6
1711static int
1712tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
1713{
1714 struct inpcb *inp = tp->t_inpcb;
1715 int error;
1716
1717 INP_WLOCK_ASSERT(inp);
1718 INP_HASH_WLOCK(&V_tcbinfo);
1719
1720 if (V_tcp_require_unique_port && inp->inp_lport == 0) {
1721 error = in6_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
1722 if (error)
1723 goto out;
1724 }
1725 error = in6_pcbconnect(inp, nam, td->td_ucred);
1726 if (error != 0)
1727 goto out;
1728 INP_HASH_WUNLOCK(&V_tcbinfo);
1729
1730 /* Compute window scaling to request. */
1731 while (tp->request_r_scale < TCP_MAX_WINSHIFT &&
1732 (TCP_MAXWIN << tp->request_r_scale) < sb_max)
1733 tp->request_r_scale++;
1734
1735 soisconnecting(inp->inp_socket);
1736 TCPSTAT_INC(tcps_connattempt);
1737 tcp_state_change(tp, TCPS_SYN_SENT);
1738 tp->iss = tcp_new_isn(&inp->inp_inc);
1739 if (tp->t_flags & TF_REQ_TSTMP)
1740 tp->ts_offset = tcp_new_ts_offset(&inp->inp_inc);
1741 tcp_sendseqinit(tp);
1742
1743 return 0;
1744
1745out:
1746 INP_HASH_WUNLOCK(&V_tcbinfo);
1747 return error;
1748}
1749#endif /* INET6 */
1750
1751/*

Callers 2

tcp6_usr_connectFunction · 0.85
tcp_usr_sendFunction · 0.85

Calls 6

in6_pcbbindFunction · 0.85
in6_pcbconnectFunction · 0.85
soisconnectingFunction · 0.85
tcp_state_changeFunction · 0.85
tcp_new_isnFunction · 0.85
tcp_new_ts_offsetFunction · 0.85

Tested by

no test coverage detected