From 1a1c360f1d074be4d5fcb297c2140523555ba55c Mon Sep 17 00:00:00 2001 From: goldsimon Date: Mon, 3 Jul 2017 21:41:34 +0200 Subject: [PATCH] Fixed LWIP_TCP_SACK_VALID and its usage --- src/core/tcp_in.c | 2 +- src/include/lwip/tcp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 2e688a25..8a2f8450 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -1587,7 +1587,7 @@ tcp_receive(struct tcp_pcb *pcb) tcp_ack(pcb); #if LWIP_TCP_SACK_OUT - if (!LWIP_TCP_SACK_VALID(pcb, 0)) { + if (LWIP_TCP_SACK_VALID(pcb, 0)) { /* Normally the ACK for the data received could be piggy-backed on a data packet, but lwIP currently does not support including SACKs in data packets. So we force it to respond with an empty ACK packet (only if there is at least one SACK to be sent). diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h index 89f9dd79..078b90a3 100644 --- a/src/include/lwip/tcp.h +++ b/src/include/lwip/tcp.h @@ -246,7 +246,7 @@ struct tcp_pcb { #if LWIP_TCP_SACK_OUT /* SACK ranges to include in ACK packets (entry is invalid if left==right) */ struct tcp_sack_range rcv_sacks[LWIP_TCP_MAX_SACK_NUM]; -#define LWIP_TCP_SACK_VALID(pcb, idx) ((pcb)->rcv_sacks[idx].left == (pcb)->rcv_sacks[idx].right) +#define LWIP_TCP_SACK_VALID(pcb, idx) ((pcb)->rcv_sacks[idx].left != (pcb)->rcv_sacks[idx].right) #endif /* LWIP_TCP_SACK_OUT */ /* Retransmission timer. */