-
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?
Conversation
Summary: In current script, we can either specify every tcp option of a packet, or use <...> for "any tcp options". This is not flexible enough, as some script may have requirements for some tcp options; while be flexible with other options. This patch tries to address this by adding wildcard for option wscale. Specifically, "wscale *" in the tcp option list means any wscale value. To mark a tcp option in the script as wildcard, we leverage the highest bit of tcp_option->kind, as TCPOPT_WILDCARD (0x80). tcp_option->kind of TCPOPT_WILDCARD | TCPOPT_WINDOW (0x83) means wscale option of any value. verify_outbound_live_tcp_options() is updated to be able to understand TCPOPT_WILDCARD. Reviewed-by: Lawrence Brakmo <[email protected]> Signed-off-by: Song Liu <[email protected]>
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
1 similar comment
I signed it! |
CLAs look good, thanks! |
@nealcardwell Could you please help review this PR? Or maybe there is any restrictions on external contributions? Thanks in advance! |
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
There are options with the 0x80 bit set:
https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xhtml
So I would suggest tightening this up:
/* Sometimes skip btye-to-byte comparison of wildcard option */
if (s_opt->kind == (TCPOPT_WILDCARD | TCPOPT_WINDOW))
@@ -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) != |
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)) {
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.
Thanks for posting this patch! Sorry for the very delayed review.
nit: for consistency with the other patches in the packetdrill code base, can you please use a first summary line like:
net-test: packetdrill: add support of tcp option wildcard "wscale *"
Thanks!
Hi @nealcardwell ! So... a few years have passed by since this PR was last updated. I like to get this going, but before putting work into it, want to check that this is something that you would still accept after addressing the comments. Thanks |
@liu-song-6 and I discusses this offline and I will likely spinning up a new PR to take over his initial work. |
Great. I added some new comments today. Please address those as well: Thanks! |
ok, I have pushed this change in #75 . I need to sort out the CLA and will probably force-push with my corporate email later. In the meantime, feedback is welcome. Thanks |
Summary:
In current script, we can either specify every tcp option of a packet,
or use <...> for "any tcp options". This is not flexible enough, as
some script may have requirements for some tcp options; while be flexible
with other options.
This patch tries to address this by adding wildcard for option wscale.
Specifically, "wscale *" in the tcp option list means any wscale value.
To mark a tcp option in the script as wildcard, we leverage the highest
bit of tcp_option->kind, as TCPOPT_WILDCARD (0x80). tcp_option->kind of
TCPOPT_WILDCARD | TCPOPT_WINDOW (0x83) means wscale option of any value.
verify_outbound_live_tcp_options() is updated to be able to understand
TCPOPT_WILDCARD.
Reviewed-by: Lawrence Brakmo [email protected]
Signed-off-by: Song Liu [email protected]