Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_stacks/rack.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 8,181 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, but avoid silly | * Calculate receive window. Don't shrink window, but avoid silly | ||||
* window syndrome. | * window syndrome. | ||||
* If a RST segment is sent, advertise a window of zero. | |||||
*/ | */ | ||||
if (flags & TH_RST) { | |||||
recwin = 0; | |||||
} else { | |||||
if (recwin < (long)(so->so_rcv.sb_hiwat / 4) && | if (recwin < (long)(so->so_rcv.sb_hiwat / 4) && | ||||
recwin < (long)tp->t_maxseg) | recwin < (long)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 < (long)(tp->rcv_adv - tp->rcv_nxt)) | recwin < (long)(tp->rcv_adv - tp->rcv_nxt)) | ||||
recwin = (long)(tp->rcv_adv - tp->rcv_nxt); | recwin = (long)(tp->rcv_adv - tp->rcv_nxt); | ||||
if (recwin > (long)TCP_MAXWIN << tp->rcv_scale) | if (recwin > (long)TCP_MAXWIN << tp->rcv_scale) | ||||
recwin = (long)TCP_MAXWIN << tp->rcv_scale; | recwin = (long)TCP_MAXWIN << tp->rcv_scale; | ||||
} | |||||
/* | /* | ||||
* According to RFC1323 the window field in a SYN (i.e., a <SYN> or | * According to RFC1323 the window field in a SYN (i.e., a <SYN> or | ||||
* <SYN,ACK>) segment itself is never scaled. The <SYN,ACK> case is | * <SYN,ACK>) segment itself is never scaled. The <SYN,ACK> case is | ||||
* handled in syncache. | * handled in syncache. | ||||
*/ | */ | ||||
if (flags & TH_SYN) | if (flags & TH_SYN) | ||||
th->th_win = htons((u_short) | th->th_win = htons((u_short) | ||||
▲ Show 20 Lines • Show All 934 Lines • Show Last 20 Lines |