You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/06/07 18:12:54 UTC
[GitHub] [incubator-nuttx] hartmannathan commented on a change in pull request #3865: Fix tcp seq wrap around issues
hartmannathan commented on a change in pull request #3865:
URL: https://github.com/apache/incubator-nuttx/pull/3865#discussion_r646830480
##########
File path: net/tcp/tcp.h
##########
@@ -86,6 +86,15 @@
# endif
#endif
+/* 32-bit modular arithmetics for tcp sequence numbers */
+
+#define TCP_SEQ_LT(a, b) ((int32_t)((a) - (b)) < 0)
+#define TCP_SEQ_GT(a, b) TCP_SEQ_LT(b, a)
+#define TCP_SEQ_LTE(a, b) !TCP_SEQ_GT(a, b)
Review comment:
May I suggest:
`#define TCP_SEQ_LTE(a, b) (!TCP_SEQ_GT(a, b))`
(Added parenthesis around the definition.)
##########
File path: net/tcp/tcp.h
##########
@@ -86,6 +86,15 @@
# endif
#endif
+/* 32-bit modular arithmetics for tcp sequence numbers */
+
+#define TCP_SEQ_LT(a, b) ((int32_t)((a) - (b)) < 0)
+#define TCP_SEQ_GT(a, b) TCP_SEQ_LT(b, a)
+#define TCP_SEQ_LTE(a, b) !TCP_SEQ_GT(a, b)
+#define TCP_SEQ_GTE(a, b) !TCP_SEQ_LT(a, b)
Review comment:
Same suggestion here:
`#define TCP_SEQ_GTE(a, b) (!TCP_SEQ_LT(a, b))`
(Added parenthesis.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org