-
Notifications
You must be signed in to change notification settings - Fork 221
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
Add support of tcp option wildcard "wscale *" #10
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -1248,14 +1248,18 @@ static int verify_outbound_live_tcp_options( | |
/* TCP options are expected to be a deterministic order. */ | ||
while (a_opt != NULL || s_opt != NULL) { | ||
if (a_opt == NULL || s_opt == NULL || | ||
a_opt->kind != s_opt->kind) { | ||
(a_opt->kind & ~TCPOPT_WILDCARD) != | ||
(s_opt->kind & ~TCPOPT_WILDCARD)) { | ||
asprintf(error, "bad outbound TCP options"); | ||
return STATUS_ERR; | ||
} | ||
|
||
if (verify_outbound_tcp_option(config, actual_packet, | ||
script_packet, a_opt, s_opt, | ||
error) != STATUS_OK) { | ||
/* skip btye-to-byte comparison of wildcard option */ | ||
if ((a_opt->kind | s_opt->kind) & TCPOPT_WILDCARD) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we only want to skip the verify_outbound_tcp_option() call if the script packet has the TCPOPT_WILDCARD bit set. If the actual packet has bit 0x80 set for some reason then AFAICT this indicates a kernel bug, and not something we should ignore. How about: if (s_opt->kind & TCPOPT_WILDCARD) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are options with the 0x80 bit set: So I would suggest tightening this up:
|
||
; | ||
else if (verify_outbound_tcp_option(config, actual_packet, | ||
script_packet, a_opt, s_opt, | ||
error) != STATUS_OK) { | ||
return STATUS_ERR; | ||
} | ||
|
||
|
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.
This seems like it would ignore cases where the actual packet has bit 0x80 set for some reason; AFAICT this would indicate a kernel bug, and is not something we should ignore.
There is also the case for an actual TCP option number that sets the 0x80 bit:
#define TCPOPT_EXP 254 /* Experimental */
If the script says the option type is supposed to be TCPOPT_EXP then we should check that all bits really match TCPOPT_EXP.
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.
I would suggest tightening this up with something like:
if (a_opt == NULL || s_opt == NULL ||
(a_opt->kind != s_opt->kind &&
!(s_opt->kind == (TCPOPT_WILDCARD | TCPOPT_WINDOW) &&
a_opt->kind == TCPOPT_WINDOW)) {