Lines Matching refs:optlen

203 	unsigned ipoptlen, optlen, hdrlen, ulen;  in tcp_default_output()  local
779 optlen = 0; in tcp_default_output()
882 hdrlen += optlen = tcp_addoptions(&to, opt); in tcp_default_output()
905 if (len + optlen + ipoptlen > tp->t_maxseg) { in tcp_default_output()
947 max_len = tp->t_maxseg - optlen - ipsec_optlen; in tcp_default_output()
977 if (optlen + ipoptlen >= tp->t_maxseg) { in tcp_default_output()
991 len = tp->t_maxseg - optlen - ipoptlen; in tcp_default_output()
1101 if (len <= (tp->t_maxseg - optlen)) { in tcp_default_output()
1268 if (optlen) { in tcp_default_output()
1269 bcopy(opt, th + 1, optlen); in tcp_default_output()
1270 th->th_off = (sizeof (struct tcphdr) + optlen) >> 2; in tcp_default_output()
1369 sizeof(struct tcphdr) + optlen + len, IPPROTO_TCP, in tcp_default_output()
1391 IPPROTO_TCP + len + optlen)); in tcp_default_output()
1405 KASSERT(len > tp->t_maxseg - optlen - ipsec_optlen, in tcp_default_output()
1408 m->m_pkthdr.tso_segsz = tp->t_maxseg - optlen - ipsec_optlen; in tcp_default_output()
1808 u_int32_t mask, optlen = 0; in tcp_addoptions() local
1813 if (optlen == TCP_MAXOLEN) in tcp_addoptions()
1817 while (optlen % 4) { in tcp_addoptions()
1818 optlen += TCPOLEN_NOP; in tcp_addoptions()
1821 if (TCP_MAXOLEN - optlen < TCPOLEN_MAXSEG) in tcp_addoptions()
1823 optlen += TCPOLEN_MAXSEG; in tcp_addoptions()
1831 while (!optlen || optlen % 2 != 1) { in tcp_addoptions()
1832 optlen += TCPOLEN_NOP; in tcp_addoptions()
1835 if (TCP_MAXOLEN - optlen < TCPOLEN_WINDOW) in tcp_addoptions()
1837 optlen += TCPOLEN_WINDOW; in tcp_addoptions()
1843 while (optlen % 2) { in tcp_addoptions()
1844 optlen += TCPOLEN_NOP; in tcp_addoptions()
1847 if (TCP_MAXOLEN - optlen < TCPOLEN_SACK_PERMITTED) in tcp_addoptions()
1849 optlen += TCPOLEN_SACK_PERMITTED; in tcp_addoptions()
1854 while (!optlen || optlen % 4 != 2) { in tcp_addoptions()
1855 optlen += TCPOLEN_NOP; in tcp_addoptions()
1858 if (TCP_MAXOLEN - optlen < TCPOLEN_TIMESTAMP) in tcp_addoptions()
1860 optlen += TCPOLEN_TIMESTAMP; in tcp_addoptions()
1874 while (!optlen || optlen % 4 != 2) { in tcp_addoptions()
1875 optlen += TCPOLEN_NOP; in tcp_addoptions()
1878 if (TCP_MAXOLEN - optlen < TCPOLEN_SIGNATURE) { in tcp_addoptions()
1882 optlen += TCPOLEN_SIGNATURE; in tcp_addoptions()
1896 while (!optlen || optlen % 4 != 2) { in tcp_addoptions()
1897 optlen += TCPOLEN_NOP; in tcp_addoptions()
1900 if (TCP_MAXOLEN - optlen < TCPOLEN_SACKHDR + TCPOLEN_SACK) in tcp_addoptions()
1902 optlen += TCPOLEN_SACKHDR; in tcp_addoptions()
1905 (TCP_MAXOLEN - optlen) / TCPOLEN_SACK); in tcp_addoptions()
1914 optlen += TCPOLEN_SACK; in tcp_addoptions()
1926 if (TCP_MAXOLEN - optlen < total_len) { in tcp_addoptions()
1936 optlen += total_len; in tcp_addoptions()
1946 if (optlen % 4) { in tcp_addoptions()
1947 optlen += TCPOLEN_EOL; in tcp_addoptions()
1956 while (optlen % 4) { in tcp_addoptions()
1957 optlen += TCPOLEN_PAD; in tcp_addoptions()
1961 KASSERT(optlen <= TCP_MAXOLEN, ("%s: TCP options too long", __func__)); in tcp_addoptions()
1962 return (optlen); in tcp_addoptions()