Skip to content

Commit

Permalink
Bug #863: test update to diagnose TOS test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
fklassen committed Jun 2, 2024
1 parent c059a37 commit 68a11b9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tcpedit/tcpedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr, u_char **pktdata
volatile uint16_t oldcsum, newval;

Check warning on line 186 in src/tcpedit/tcpedit.c

View workflow job for this annotation

GitHub Actions / cpp-linter

src/tcpedit/tcpedit.c:186:13 [readability-isolate-declaration]

multiple declarations in a single statement reduces readability

Check warning on line 186 in src/tcpedit/tcpedit.c

View workflow job for this annotation

GitHub Actions / cpp-linter

src/tcpedit/tcpedit.c:186:31 [cppcoreguidelines-init-variables]

variable 'oldcsum' is not initialized

Check warning on line 186 in src/tcpedit/tcpedit.c

View workflow job for this annotation

GitHub Actions / cpp-linter

src/tcpedit/tcpedit.c:186:40 [cppcoreguidelines-init-variables]

variable 'newval' is not initialized

// ip_hdr->ip_tos = tcpedit->tos;
// newval = *((uint16_t *)ip_hdr);
newval = htons((ntohs(*((uint16_t *)ip_hdr)) & 0xff00) | (tcpedit->tos & 0xff));
newval = *((uint16_t *)ip_hdr);
newval = htons((ntohs(newval) & 0xff00) | (tcpedit->tos & 0xff));
*((uint16_t *)ip_hdr) = newval;
oldcsum = ip_hdr->ip_sum;
static uint32_t cnt;
csum_replace2(&ip_hdr->ip_sum, oldval, newval);
Expand Down

0 comments on commit 68a11b9

Please sign in to comment.