Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nddq committed Mar 27, 2024
1 parent d708987 commit 582c716
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/plugin/packetparser/_cprog/dynamic.h
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#define BYPASS_LOOKUP_IP_OF_INTEREST 0
// Place holder header file that will be replaced by the actual header file during runtime
// DO NOT DELETE
3 changes: 2 additions & 1 deletion pkg/plugin/packetparser/_cprog/packetparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const struct packet *unused __attribute__((unused));
* - https://github.com/xdp-project/bpf-examples
* - https://www.ietf.org/rfc/rfc9293.html
* - https://www.rfc-editor.org/rfc/pdfrfc/rfc7323.txt.pdf
* May explore using bpf_loop() in the future (kernel 5.17+)
*/
static int parse_tcp_ts(struct tcphdr *tcph, void *data_end, __u32 *tsval, __u32 *tsecr) {
// Get the length of the TCP header.
Expand Down Expand Up @@ -111,7 +112,7 @@ static int parse_tcp_ts(struct tcphdr *tcph, void *data_end, __u32 *tsval, __u32
continue;
default:
// Some kind of option.

// Since each option is at least 2 bytes long, we need to check that adding 2 to the pointer will not go past the end of the packet.
if (tcp_options_cur_ptr + 2 > tcp_opt_end_ptr || tcp_options_cur_ptr + 2 > data_end) {
return -1;
Expand Down

0 comments on commit 582c716

Please sign in to comment.