-
Notifications
You must be signed in to change notification settings - Fork 18
More fixes (fixes-4) #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
2a36ed7
5d4b920
539a212
d3fb63a
dcc97cf
07db050
62f2b7b
f6d3e90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -119,10 +119,10 @@ struct wolfIP_icmp_packet; | |||||||||||||||||||||||||||
| /* Macros */ | ||||||||||||||||||||||||||||
| #define IS_IP_BCAST(ip) (ip == 0xFFFFFFFF) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| #define PKT_FLAG_SENT 0x01 | ||||||||||||||||||||||||||||
| #define PKT_FLAG_ACKED 0x02 | ||||||||||||||||||||||||||||
| #define PKT_FLAG_FIN 0x04 | ||||||||||||||||||||||||||||
| #define PKT_FLAG_RETRANS 0x08 | ||||||||||||||||||||||||||||
| #define PKT_FLAG_SENT 0x01U | ||||||||||||||||||||||||||||
| #define PKT_FLAG_ACKED 0x02U | ||||||||||||||||||||||||||||
| #define PKT_FLAG_FIN 0x04U | ||||||||||||||||||||||||||||
| #define PKT_FLAG_RETRANS 0x08U | ||||||||||||||||||||||||||||
| #define TX_WRITABLE_THRESHOLD 1 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| #define TCP_SACK_MAX_BLOCKS 4 | ||||||||||||||||||||||||||||
|
|
@@ -504,6 +504,16 @@ static uint32_t queue_len(struct queue *q) | |||||||||||||||||||||||||||
| return (q->size - 1) - queue_space(q); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| /* Subtract two TCP sequence numbers: a - b (wraps at 2^32) */ | ||||||||||||||||||||||||||||
| static inline uint32_t tcp_seq_diff(uint32_t a, uint32_t b) | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| if (a >= b) | ||||||||||||||||||||||||||||
| return a - b; | ||||||||||||||||||||||||||||
| return UINT32_MAX - (b - a - 1); | ||||||||||||||||||||||||||||
|
Comment on lines
+508
to
+513
|
||||||||||||||||||||||||||||
| /* Subtract two TCP sequence numbers: a - b (wraps at 2^32) */ | |
| static inline uint32_t tcp_seq_diff(uint32_t a, uint32_t b) | |
| { | |
| if (a >= b) | |
| return a - b; | |
| return UINT32_MAX - (b - a - 1); | |
| /* Subtract two TCP sequence numbers: a - b (wraps at 2^32) | |
| * and interpret the result as a signed relative distance. */ | |
| static inline int32_t tcp_seq_diff(uint32_t a, uint32_t b) | |
| { | |
| /* Sequence arithmetic is modulo 2^32; cast to int32_t to get | |
| * a signed relative distance in the range [-2^31, 2^31-1]. */ | |
| return (int32_t)(a - b); |
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tcp_seq_diff() returns uint32_t, but at least one call site treats the result as signed (rel < 0). This makes the behavior dependent on an implicit unsigned→signed conversion (implementation-defined when the value is not representable), which can break the “old data behind seq_base is rejected” logic—especially around wrap or large gaps. Consider changing tcp_seq_diff to return an int32_t “relative distance” (the same semantic as the prior (int32_t)(seq - base) approach) and update call sites accordingly, or keep it unsigned but remove signed comparisons and use wrap-aware ordering helpers consistently.
danielinux marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The duplicate-SYN filter does not include the local IP in the tuple comparison. If the stack can listen on multiple local IPs (or IPADDR_ANY) with the same local port, a SYN to a different local IP could be incorrectly rejected just because an established connection exists with the same remote endpoint and ports. Include the appropriate local identifier(s) in the match (e.g., tk->local_ip/syn_dst, and potentially if_idx if that’s part of the effective demux key in this stack) so only truly identical connections are considered duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suite_add_tcase(s, tc_proto)is called multiple times for the sametc_protoobject in this block (including the newly added calls). In Check, adding the sameTCase*to a suite more than once can lead to duplicated execution or undefined behavior depending on the library/version. The safer pattern is to addtc_prototo the suite once, and only calltcase_add_test()for each additional test.