Skip to content
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

Rewrite dst MAC with host gateway's MAC #213

Merged
merged 1 commit into from
Dec 12, 2019

Conversation

wenyingd
Copy link
Contributor

@wenyingd wenyingd commented Dec 9, 2019

Rewrite dst MAC with host gateway's MAC for the packets sent back from the
Endpoint located on the same Node as the sender, and not use ct_label as the
cache for dynamic learning.

Fixes #211

@antrea-bot
Copy link
Collaborator

Thanks for your PR.
Unit tests and code linters are run automatically every time the PR is updated.
E2e tests can only be triggered by a member of the vmware-tanzu organization. Regular contributors to the project should join the org.

The following commands are available:

  • /test-e2e: to trigger e2e tests. This command can only be run by members of the vmware-tanzu organization
  • /skip-e2e: to skip e2e tests. This command can only be run by members of the vmware-tanzu organization

@wenyingd
Copy link
Contributor Author

wenyingd commented Dec 9, 2019

/test-e2e

jianjuns
jianjuns previously approved these changes Dec 10, 2019
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for making this change Wenying

Action().Drop().
Done(),
}
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the return statement serving some purpose here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return here is to return the flows, it is to follow the style of named return values.
https://yourbasic.org/golang/named-return-values-parameters/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I didn't know the explicit return statement was required

// 3) Cache src MAC if traffic comes from the host gateway and rewrite the dst MAC on traffic replied from Pod to the
// cached MAC.
// 4) Drop all invalid traffic.
// 1) commit new connections to ct if the packet is sent from non-gateway.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct me if I'm wrong, but I think we commit all connections, not just the ones which come from the gateway. We have this flow:

table=31, priority=190,ct_state=+new+trk,ip actions=ct(commit,table=40,zone=65520)

and we use that for the policy tables

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we commit all connections to ct. But the flow entry you mentioned will commit non-gateway connections. As for the connections from gateway, it should hit another flow table=31, priority=200,ct_state=+new+trk,ip,reg0=0x1/0xffff actions=ct(commit,table=40,zone=65520,exec(load:0x20->NXM_NX_CT_MARK[])
The second flow has a higher priority, so the packets sent from gateway interface would hit it firstly, and other non-gateway traffic would hit the flow you mentioned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update the comments and remove the "if" conditions.

@antoninbas
Copy link
Contributor

Also, I'll take care of updating my documentation PR if this gets merged first: #206

Rewrite dst MAC with host gateway's MAC for the packets sent back from the
Endpoint located on the same Node as the sender, and not use ct_label as the
cache for dynamic learning.
@wenyingd
Copy link
Contributor Author

/test-e2e

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wenyingd wenyingd merged commit b1c1df2 into antrea-io:master Dec 12, 2019
@wenyingd wenyingd deleted the issue211 branch December 12, 2019 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use static MAC address instead of dynamic learning in conntrack state table
5 participants