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

Function tcp_mssopt

freebsd/netinet/tcp_input.c:3882–3919  ·  view source on GitHub ↗

* Determine the MSS option to send on an outgoing SYN. */

Source from the content-addressed store, hash-verified

3880 * Determine the MSS option to send on an outgoing SYN.
3881 */
3882int
3883tcp_mssopt(struct in_conninfo *inc)
3884{
3885 int mss = 0;
3886 uint32_t thcmtu = 0;
3887 uint32_t maxmtu = 0;
3888 size_t min_protoh;
3889
3890 KASSERT(inc != NULL, ("tcp_mssopt with NULL in_conninfo pointer"));
3891
3892#ifdef INET6
3893 if (inc->inc_flags & INC_ISIPV6) {
3894 mss = V_tcp_v6mssdflt;
3895 maxmtu = tcp_maxmtu6(inc, NULL);
3896 min_protoh = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
3897 }
3898#endif
3899#if defined(INET) && defined(INET6)
3900 else
3901#endif
3902#ifdef INET
3903 {
3904 mss = V_tcp_mssdflt;
3905 maxmtu = tcp_maxmtu(inc, NULL);
3906 min_protoh = sizeof(struct tcpiphdr);
3907 }
3908#endif
3909#if defined(INET6) || defined(INET)
3910 thcmtu = tcp_hc_getmtu(inc); /* IPv4 and IPv6 */
3911#endif
3912
3913 if (maxmtu && thcmtu)
3914 mss = min(maxmtu, thcmtu) - min_protoh;
3915 else if (maxmtu || thcmtu)
3916 mss = max(maxmtu, thcmtu) - min_protoh;
3917
3918 return (mss);
3919}
3920
3921void
3922tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th)

Callers 4

tcp_output.cFile · 0.85
syncache_respondFunction · 0.85
rack.cFile · 0.85
bbr.cFile · 0.85

Calls 5

tcp_maxmtu6Function · 0.85
tcp_maxmtuFunction · 0.85
tcp_hc_getmtuFunction · 0.85
minFunction · 0.85
maxFunction · 0.85

Tested by

no test coverage detected