| 1822 | #define INP_WLOCK_RECHECK(inp) INP_WLOCK_RECHECK_CLEANUP((inp), /* noop */) |
| 1823 | |
| 1824 | int |
| 1825 | tcp_ctloutput(struct socket *so, struct sockopt *sopt) |
| 1826 | { |
| 1827 | int error; |
| 1828 | struct inpcb *inp; |
| 1829 | struct tcpcb *tp; |
| 1830 | struct tcp_function_block *blk; |
| 1831 | struct tcp_function_set fsn; |
| 1832 | |
| 1833 | error = 0; |
| 1834 | inp = sotoinpcb(so); |
| 1835 | KASSERT(inp != NULL, ("tcp_ctloutput: inp == NULL")); |
| 1836 | if (sopt->sopt_level != IPPROTO_TCP) { |
| 1837 | #ifdef INET6 |
| 1838 | if (inp->inp_vflag & INP_IPV6PROTO) { |
| 1839 | error = ip6_ctloutput(so, sopt); |
| 1840 | /* |
| 1841 | * In case of the IPV6_USE_MIN_MTU socket option, |
| 1842 | * the INC_IPV6MINMTU flag to announce a corresponding |
| 1843 | * MSS during the initial handshake. |
| 1844 | * If the TCP connection is not in the front states, |
| 1845 | * just reduce the MSS being used. |
| 1846 | * This avoids the sending of TCP segments which will |
| 1847 | * be fragmented at the IPv6 layer. |
| 1848 | */ |
| 1849 | if ((error == 0) && |
| 1850 | (sopt->sopt_dir == SOPT_SET) && |
| 1851 | (sopt->sopt_level == IPPROTO_IPV6) && |
| 1852 | (sopt->sopt_name == IPV6_USE_MIN_MTU)) { |
| 1853 | INP_WLOCK(inp); |
| 1854 | if ((inp->inp_flags & |
| 1855 | (INP_TIMEWAIT | INP_DROPPED))) { |
| 1856 | INP_WUNLOCK(inp); |
| 1857 | return (ECONNRESET); |
| 1858 | } |
| 1859 | inp->inp_inc.inc_flags |= INC_IPV6MINMTU; |
| 1860 | tp = intotcpcb(inp); |
| 1861 | if ((tp->t_state >= TCPS_SYN_SENT) && |
| 1862 | (inp->inp_inc.inc_flags & INC_ISIPV6)) { |
| 1863 | struct ip6_pktopts *opt; |
| 1864 | |
| 1865 | opt = inp->in6p_outputopts; |
| 1866 | if ((opt != NULL) && |
| 1867 | (opt->ip6po_minmtu == |
| 1868 | IP6PO_MINMTU_ALL)) { |
| 1869 | if (tp->t_maxseg > TCP6_MSS) { |
| 1870 | tp->t_maxseg = TCP6_MSS; |
| 1871 | } |
| 1872 | } |
| 1873 | } |
| 1874 | INP_WUNLOCK(inp); |
| 1875 | } |
| 1876 | } |
| 1877 | #endif /* INET6 */ |
| 1878 | #if defined(INET6) && defined(INET) |
| 1879 | else |
| 1880 | #endif |
| 1881 | #ifdef INET |
nothing calls this directly
no test coverage detected