mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-04 12:39:58 +00:00
tcp: add a define for maximum option bytes
This commit is contained in:
parent
2c3c578475
commit
9fb86f6e4b
@ -1137,7 +1137,7 @@ tcp_get_num_sacks(struct tcp_pcb *pcb, u8_t optlen)
|
||||
optlen += 12;
|
||||
|
||||
/* Max options size = 40, number of SACK array entries = LWIP_TCP_MAX_SACK_NUM */
|
||||
for (i = 0; (i < LWIP_TCP_MAX_SACK_NUM) && (optlen <= 40) && LWIP_TCP_SACK_VALID(pcb, i); ++i) {
|
||||
for (i = 0; (i < LWIP_TCP_MAX_SACK_NUM) && (optlen <= TCP_MAX_OPTION_BYTES) && LWIP_TCP_SACK_VALID(pcb, i); ++i) {
|
||||
++num_sacks;
|
||||
optlen += 8;
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ PACK_STRUCT_END
|
||||
/* Valid TCP header flags */
|
||||
#define TCP_FLAGS 0x3fU
|
||||
|
||||
#define TCP_MAX_OPTION_BYTES 40
|
||||
|
||||
#define TCPH_HDRLEN(phdr) ((u16_t)(lwip_ntohs((phdr)->_hdrlen_rsvd_flags) >> 12))
|
||||
#define TCPH_HDRLEN_BYTES(phdr) ((u8_t)(TCPH_HDRLEN(phdr) << 2))
|
||||
#define TCPH_FLAGS(phdr) ((u8_t)((lwip_ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user