Lines Matching defs:optlen

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