mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
tcp_output_fill_options: account for the SACKS length in assertion.
This commit is contained in:
parent
56124bf53b
commit
59e98ccb19
@ -1820,6 +1820,7 @@ tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags
|
|||||||
{
|
{
|
||||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||||
u32_t *opts = (u32_t *)(void *)(tcphdr + 1);
|
u32_t *opts = (u32_t *)(void *)(tcphdr + 1);
|
||||||
|
u16_t sacks_len = 0;
|
||||||
|
|
||||||
/* NB. MSS and window scale options are only sent on SYNs, so ignore them here */
|
/* NB. MSS and window scale options are only sent on SYNs, so ignore them here */
|
||||||
|
|
||||||
@ -1834,7 +1835,8 @@ tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags
|
|||||||
if (num_sacks > 0) {
|
if (num_sacks > 0) {
|
||||||
tcp_build_sack_option(pcb, opts, num_sacks);
|
tcp_build_sack_option(pcb, opts, num_sacks);
|
||||||
/* 1 word for SACKs header (including 2xNOP), and 2 words for each SACK */
|
/* 1 word for SACKs header (including 2xNOP), and 2 words for each SACK */
|
||||||
opts += 1 + num_sacks * 2;
|
sacks_len = 1 + num_sacks * 2;
|
||||||
|
opts += sacks_len;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
LWIP_UNUSED_ARG(num_sacks);
|
LWIP_UNUSED_ARG(num_sacks);
|
||||||
@ -1845,7 +1847,8 @@ tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
LWIP_ASSERT("options not filled", (u8_t *)opts == ((u8_t *)(tcphdr + 1)) + LWIP_TCP_OPT_LENGTH_SEGMENT(optflags, pcb));
|
LWIP_UNUSED_ARG(sacks_len);
|
||||||
|
LWIP_ASSERT("options not filled", (u8_t *)opts == ((u8_t *)(tcphdr + 1)) + sacks_len * 4 + LWIP_TCP_OPT_LENGTH_SEGMENT(optflags, pcb));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Output a control segment pbuf to IP.
|
/** Output a control segment pbuf to IP.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user