* Determine the MSS option to send on an outgoing SYN. */
| 3880 | * Determine the MSS option to send on an outgoing SYN. |
| 3881 | */ |
| 3882 | int |
| 3883 | tcp_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 | |
| 3921 | void |
| 3922 | tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) |
no test coverage detected