Skip to content

Commit

Permalink
issue: 2246994 Fix TCPH_UNSET_FLAG() macro
Browse files Browse the repository at this point in the history
TCPH_UNSET_FLAG() is broken and doesn't clean any flag. Operation OR
doesn't clear flag if we remove it only from right operand.

Signed-off-by: Dmytro Podgornyi <[email protected]>
  • Loading branch information
pasis authored and igor-ivanov committed Mar 25, 2021
1 parent 0e26740 commit 63eafe1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vma/lwip/tcp_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ PACK_STRUCT_END
#define TCPH_HDRLEN_FLAGS_SET(phdr, len, flags) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | (flags))

#define TCPH_SET_FLAG(phdr, flags ) (phdr)->_hdrlen_rsvd_flags = ((phdr)->_hdrlen_rsvd_flags | htons(flags))
#define TCPH_UNSET_FLAG(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (TCPH_FLAGS(phdr) & ~(flags)) )
#define TCPH_UNSET_FLAG(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (phdr)->_hdrlen_rsvd_flags & (~htons((flags) & (TCP_FLAGS)))

#define TCP_TCPLEN(seg) ((seg)->len + (((TCPH_FLAGS((seg)->tcphdr) & (TCP_FIN | TCP_SYN)) != 0) ? 1U : 0U))

Expand Down

0 comments on commit 63eafe1

Please sign in to comment.