Fixed bug #21491: The MSS option sent (with SYN) is now based on TCP_MSS instead of pcb->mss (on passive open now effectively sending our configured TCP_MSS instead of the one received).

This commit is contained in:
goldsimon
2007-11-01 16:23:32 +00:00
parent 853765954e
commit 298d5cf042
4 changed files with 15 additions and 10 deletions

View File

@@ -491,6 +491,7 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
pcb->snd_lbb = iss - 1;
pcb->rcv_wnd = TCP_WND;
pcb->snd_wnd = TCP_WND;
/* The send MSS is updated when an MSS option is received. */
pcb->mss = TCP_MSS;
pcb->cwnd = 1;
pcb->ssthresh = pcb->mss * 10;
@@ -504,10 +505,7 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
snmp_inc_tcpactiveopens();
/* Build an MSS option */
optdata = htonl(((u32_t)2 << 24) |
((u32_t)4 << 16) |
(((u32_t)pcb->mss / 256) << 8) |
(pcb->mss & 255));
optdata = TCP_BUILD_MSS_OPTION();
ret = tcp_enqueue(pcb, NULL, 0, TCP_SYN, 0, (u8_t *)&optdata, 4);
if (ret == ERR_OK) {
@@ -933,6 +931,7 @@ tcp_alloc(u8_t prio)
pcb->rcv_wnd = TCP_WND;
pcb->tos = 0;
pcb->ttl = TCP_TTL;
/* The send MSS is updated when an MSS option is received. */
pcb->mss = TCP_MSS;
pcb->rto = 3000 / TCP_SLOW_INTERVAL;
pcb->sa = 0;

View File

@@ -415,10 +415,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
snmp_inc_tcppassiveopens();
/* Build an MSS option. */
optdata = htonl(((u32_t)2 << 24) |
((u32_t)4 << 16) |
(((u32_t)npcb->mss / 256) << 8) |
(npcb->mss & 255));
optdata = TCP_BUILD_MSS_OPTION();
/* Send a SYN|ACK together with the MSS option. */
tcp_enqueue(npcb, NULL, 0, TCP_SYN | TCP_ACK, 0, (u8_t *)&optdata, 4);
return tcp_output(npcb);