Revision 9634d903 slirp/tcp_input.c
b/slirp/tcp_input.c | ||
---|---|---|
47 | 47 |
|
48 | 48 |
struct socket tcb; |
49 | 49 |
|
50 |
int tcprexmtthresh = 3;
|
|
50 |
#define TCPREXMTTHRESH 3
|
|
51 | 51 |
struct socket *tcp_last_so = &tcb; |
52 | 52 |
|
53 | 53 |
tcp_seq tcp_iss; /* tcp initial send seq # */ |
... | ... | |
112 | 112 |
} \ |
113 | 113 |
} |
114 | 114 |
#endif |
115 |
static void tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, |
|
116 |
struct tcpiphdr *ti); |
|
117 |
static void tcp_xmit_timer(register struct tcpcb *tp, int rtt); |
|
115 | 118 |
|
116 |
int |
|
117 |
tcp_reass(tp, ti, m) |
|
118 |
register struct tcpcb *tp; |
|
119 |
register struct tcpiphdr *ti; |
|
120 |
struct mbuf *m; |
|
119 |
static int |
|
120 |
tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti, |
|
121 |
struct mbuf *m) |
|
121 | 122 |
{ |
122 | 123 |
register struct tcpiphdr *q; |
123 | 124 |
struct socket *so = tp->t_socket; |
... | ... | |
402 | 403 |
goto dropwithreset; |
403 | 404 |
} |
404 | 405 |
|
405 |
sbreserve(&so->so_snd, tcp_sndspace);
|
|
406 |
sbreserve(&so->so_rcv, tcp_rcvspace);
|
|
406 |
sbreserve(&so->so_snd, TCP_SNDSPACE);
|
|
407 |
sbreserve(&so->so_rcv, TCP_RCVSPACE);
|
|
407 | 408 |
|
408 | 409 |
/* tcp_last_so = so; */ /* XXX ? */ |
409 | 410 |
/* tp = sototcpcb(so); */ |
... | ... | |
448 | 449 |
* Reset idle time and keep-alive timer. |
449 | 450 |
*/ |
450 | 451 |
tp->t_idle = 0; |
451 |
if (so_options)
|
|
452 |
tp->t_timer[TCPT_KEEP] = tcp_keepintvl;
|
|
452 |
if (SO_OPTIONS)
|
|
453 |
tp->t_timer[TCPT_KEEP] = TCPTV_KEEPINTVL;
|
|
453 | 454 |
else |
454 |
tp->t_timer[TCPT_KEEP] = tcp_keepidle;
|
|
455 |
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_IDLE;
|
|
455 | 456 |
|
456 | 457 |
/* |
457 | 458 |
* Process options if not in LISTEN state, |
... | ... | |
1102 | 1103 |
if (tp->t_timer[TCPT_REXMT] == 0 || |
1103 | 1104 |
ti->ti_ack != tp->snd_una) |
1104 | 1105 |
tp->t_dupacks = 0; |
1105 |
else if (++tp->t_dupacks == tcprexmtthresh) {
|
|
1106 |
else if (++tp->t_dupacks == TCPREXMTTHRESH) {
|
|
1106 | 1107 |
tcp_seq onxt = tp->snd_nxt; |
1107 | 1108 |
u_int win = |
1108 | 1109 |
min(tp->snd_wnd, tp->snd_cwnd) / 2 / |
... | ... | |
1121 | 1122 |
if (SEQ_GT(onxt, tp->snd_nxt)) |
1122 | 1123 |
tp->snd_nxt = onxt; |
1123 | 1124 |
goto drop; |
1124 |
} else if (tp->t_dupacks > tcprexmtthresh) {
|
|
1125 |
} else if (tp->t_dupacks > TCPREXMTTHRESH) {
|
|
1125 | 1126 |
tp->snd_cwnd += tp->t_maxseg; |
1126 | 1127 |
(void) tcp_output(tp); |
1127 | 1128 |
goto drop; |
... | ... | |
1135 | 1136 |
* If the congestion window was inflated to account |
1136 | 1137 |
* for the other side's cached packets, retract it. |
1137 | 1138 |
*/ |
1138 |
if (tp->t_dupacks > tcprexmtthresh &&
|
|
1139 |
if (tp->t_dupacks > TCPREXMTTHRESH &&
|
|
1139 | 1140 |
tp->snd_cwnd > tp->snd_ssthresh) |
1140 | 1141 |
tp->snd_cwnd = tp->snd_ssthresh; |
1141 | 1142 |
tp->t_dupacks = 0; |
... | ... | |
1227 | 1228 |
*/ |
1228 | 1229 |
if (so->so_state & SS_FCANTRCVMORE) { |
1229 | 1230 |
soisfdisconnected(so); |
1230 |
tp->t_timer[TCPT_2MSL] = tcp_maxidle;
|
|
1231 |
tp->t_timer[TCPT_2MSL] = TCP_MAXIDLE;
|
|
1231 | 1232 |
} |
1232 | 1233 |
tp->t_state = TCPS_FIN_WAIT_2; |
1233 | 1234 |
} |
... | ... | |
1490 | 1491 |
/* int *ts_present; |
1491 | 1492 |
* u_int32_t *ts_val, *ts_ecr; |
1492 | 1493 |
*/ |
1493 |
void |
|
1494 |
tcp_dooptions(tp, cp, cnt, ti) |
|
1495 |
struct tcpcb *tp; |
|
1496 |
u_char *cp; |
|
1497 |
int cnt; |
|
1498 |
struct tcpiphdr *ti; |
|
1494 |
static void |
|
1495 |
tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti) |
|
1499 | 1496 |
{ |
1500 | 1497 |
u_int16_t mss; |
1501 | 1498 |
int opt, optlen; |
... | ... | |
1605 | 1602 |
* and update averages and current timeout. |
1606 | 1603 |
*/ |
1607 | 1604 |
|
1608 |
void |
|
1609 |
tcp_xmit_timer(tp, rtt) |
|
1610 |
register struct tcpcb *tp; |
|
1611 |
int rtt; |
|
1605 |
static void |
|
1606 |
tcp_xmit_timer(register struct tcpcb *tp, int rtt) |
|
1612 | 1607 |
{ |
1613 | 1608 |
register short delta; |
1614 | 1609 |
|
... | ... | |
1707 | 1702 |
DEBUG_ARG("tp = %lx", (long)tp); |
1708 | 1703 |
DEBUG_ARG("offer = %d", offer); |
1709 | 1704 |
|
1710 |
mss = min(if_mtu, if_mru) - sizeof(struct tcpiphdr);
|
|
1705 |
mss = min(IF_MTU, IF_MRU) - sizeof(struct tcpiphdr);
|
|
1711 | 1706 |
if (offer) |
1712 | 1707 |
mss = min(mss, offer); |
1713 | 1708 |
mss = max(mss, 32); |
... | ... | |
1716 | 1711 |
|
1717 | 1712 |
tp->snd_cwnd = mss; |
1718 | 1713 |
|
1719 |
sbreserve(&so->so_snd, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0)); |
|
1720 |
sbreserve(&so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0)); |
|
1714 |
sbreserve(&so->so_snd, TCP_SNDSPACE + ((TCP_SNDSPACE % mss) ? |
|
1715 |
(mss - (TCP_SNDSPACE % mss)) : |
|
1716 |
0)); |
|
1717 |
sbreserve(&so->so_rcv, TCP_RCVSPACE + ((TCP_RCVSPACE % mss) ? |
|
1718 |
(mss - (TCP_RCVSPACE % mss)) : |
|
1719 |
0)); |
|
1721 | 1720 |
|
1722 | 1721 |
DEBUG_MISC((dfd, " returning mss = %d\n", mss)); |
1723 | 1722 |
|
Also available in: Unified diff