Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_subr.c
Show First 20 Lines • Show All 3,007 Lines • ▼ Show 20 Lines | tcp_maxseg(const struct tcpcb *tp) | ||||
/* | /* | ||||
* Here we have a simplified code from tcp_addoptions(), | * Here we have a simplified code from tcp_addoptions(), | ||||
* without a proper loop, and having most of paddings hardcoded. | * without a proper loop, and having most of paddings hardcoded. | ||||
* We might make mistakes with padding here in some edge cases, | * We might make mistakes with padding here in some edge cases, | ||||
* but this is harmless, since result of tcp_maxseg() is used | * but this is harmless, since result of tcp_maxseg() is used | ||||
* only in cwnd and ssthresh estimations. | * only in cwnd and ssthresh estimations. | ||||
*/ | */ | ||||
#define PAD(len) ((((len) / 4) + !!((len) % 4)) * 4) | |||||
if (TCPS_HAVEESTABLISHED(tp->t_state)) { | if (TCPS_HAVEESTABLISHED(tp->t_state)) { | ||||
if (tp->t_flags & TF_RCVD_TSTMP) | if (tp->t_flags & TF_RCVD_TSTMP) | ||||
optlen = TCPOLEN_TSTAMP_APPA; | optlen = TCPOLEN_TSTAMP_APPA; | ||||
else | else | ||||
optlen = 0; | optlen = 0; | ||||
#if defined(IPSEC_SUPPORT) || defined(TCP_SIGNATURE) | #if defined(IPSEC_SUPPORT) || defined(TCP_SIGNATURE) | ||||
if (tp->t_flags & TF_SIGNATURE) | if (tp->t_flags & TF_SIGNATURE) | ||||
optlen += PAD(TCPOLEN_SIGNATURE); | optlen += PAD(TCPOLEN_SIGNATURE); | ||||
▲ Show 20 Lines • Show All 476 Lines • Show Last 20 Lines |