Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_output.c
Show First 20 Lines • Show All 1,166 Lines • ▼ Show 20 Lines | #endif | ||||
if (optlen) { | if (optlen) { | ||||
bcopy(opt, th + 1, optlen); | bcopy(opt, th + 1, optlen); | ||||
th->th_off = (sizeof (struct tcphdr) + optlen) >> 2; | th->th_off = (sizeof (struct tcphdr) + optlen) >> 2; | ||||
} | } | ||||
th->th_flags = flags; | th->th_flags = flags; | ||||
/* | /* | ||||
* Calculate receive window. Don't shrink window, | * Calculate receive window. Don't shrink window, | ||||
* but avoid silly window syndrome. | * but avoid silly window syndrome. | ||||
* If a RST segment is sent, advertise a window of zero. | |||||
*/ | */ | ||||
if (flags & TH_RST) { | |||||
recwin = 0; | |||||
} else { | |||||
if (recwin < (so->so_rcv.sb_hiwat / 4) && | if (recwin < (so->so_rcv.sb_hiwat / 4) && | ||||
recwin < tp->t_maxseg) | recwin < tp->t_maxseg) | ||||
recwin = 0; | recwin = 0; | ||||
if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) && | if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) && | ||||
recwin < (tp->rcv_adv - tp->rcv_nxt)) | recwin < (tp->rcv_adv - tp->rcv_nxt)) | ||||
recwin = (tp->rcv_adv - tp->rcv_nxt); | recwin = (tp->rcv_adv - tp->rcv_nxt); | ||||
} | |||||
/* | /* | ||||
* According to RFC1323 the window field in a SYN (i.e., a <SYN> | * According to RFC1323 the window field in a SYN (i.e., a <SYN> | ||||
* or <SYN,ACK>) segment itself is never scaled. The <SYN,ACK> | * or <SYN,ACK>) segment itself is never scaled. The <SYN,ACK> | ||||
* case is handled in syncache. | * case is handled in syncache. | ||||
*/ | */ | ||||
if (flags & TH_SYN) | if (flags & TH_SYN) | ||||
th->th_win = htons((u_short) | th->th_win = htons((u_short) | ||||
(min(sbspace(&so->so_rcv), TCP_MAXWIN))); | (min(sbspace(&so->so_rcv), TCP_MAXWIN))); | ||||
▲ Show 20 Lines • Show All 813 Lines • Show Last 20 Lines |