Skip to content

Commit

Permalink
Fixed a bug where packets would not be truncated if window size wasn'…
Browse files Browse the repository at this point in the history
…t 0.
  • Loading branch information
TheTarados committed Mar 22, 2022
1 parent 7d530bc commit 510b553
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion link_sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static inline int simulate_link(char *buf, int len, int direction)
return EXIT_SUCCESS;
}
/* Do we cut it after the header? (only if packet is elligible) */
if (cut_rate && RAND_PERCENT < cut_rate && len > MIN_PKT_PDATA_LEN && ((uint8_t) buf[0]) == 0x40) {
if (cut_rate && RAND_PERCENT < cut_rate && len > MIN_PKT_PDATA_LEN && ((uint8_t) buf[0])>>6 == 1) {
LOG_PKT(buf, "Truncating packet");
len = MIN_PKT_PDATA_LEN;
/* ... and don't forget to mark it as truncated */
Expand Down

0 comments on commit 510b553

Please sign in to comment.