-
Notifications
You must be signed in to change notification settings - Fork 370
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
Commit new connections after NetworkPolicy check #220
Conversation
Thanks for your PR. The following commands are available:
|
/test-e2e |
1d11714
to
4c13829
Compare
/test-e2e |
5b8524c
to
4fb5a1c
Compare
@wenyingd It seems that this didn't fix the test issue. Is there anything else at play here? |
Hi @antoninbas it doesn't work as we expected when we change to commit the connection at the end of the pipeline. In the change, we have to also commit the traffic from Pod to Service, otherwise the reply packets could be sent back to Pod without conntrack support. We could ensure the commit is taken after NetworkPolicy check for Pod to Pod traffic, but it doesn't suit for Service traffic. For we could not predict the final action is to drop to allow for Service traffic before iptables NAT is taken. |
@wenyingd I understand your comment. I'm fine with committing both connections (pre-DNAT and post-DNAT). I am not sure whether there is an alternative solution. Maybe we could accept all traffic if the source IP is in the service CIDR? I'm not sure it's better though... I tested your changes locally and they work. The Kind test is failing for your Pod->Pod traffic test because BTW, I thought of another potential fix to the original issue: we could use |
@antoninbas Thanks for verifying the change. I don't think I change the UT to leverage Pod is because origianlly it has failed when the test case is using Service address. And we doubt the reason is we have committed all connections destined at the Service to the ct, no matter it would be dropped by NP rule or not. And I think our design for committing the connection after NP rule check might not work for the Service case, at least not work for the Service if it is depending on iptables but not Openflow. I don't understand "Maybe we could accept all traffic if the source IP is in the service CIDR?", for I don't think there is any traffic using the service CIDR as source IP. |
See replies inline
We only need it to work for reply packets. subsequent packets from the sender can still go through the regular flows (with no performance penalty IMO). Actually that may be a good thing because right now if a network policy is updated while a long-lived connection has already been established, the new network policy will never be applied to the existing connection. We discussed this with @salv-orlando and we thought it could be better to have a way to enforce new network policies to existing connections.
Confirmed that the test case passes when using Pods directly with the following change:
When reply traffic goes through kube-proxy, the source IP gets rewritten to the service IP, so that the 5-tuple is correct when the senders receives the reply traffic. For example, when you capture traffic on the gw interface you may see that:
|
At this stage it seems that this patch (commit connection to Pods after network policy enforcement) is a good workaround for the issue with the netdev implementation of conntrack, so unless I am misunderstanding something I believe we can merge it. The next step would be to reproduce the issue with a simple 2-table pipeline using only the OVS command-line tools, so we can report the issue to the OVS project. |
Add conntrackCommitTable(antrea-io#105) between ingressDefaultTable(#100) and L2ForwardingOutTable(antrea-io#110), and packets in the new connections are committed in this table. Packet could be resubmitted to conntrackCommit table from DNATTable and ingressDefaultTable.
/test-e2e |
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.
LGTM
Add conntrackCommit table(#105) between ingressDefault table(#100) and
L2ForwardingOut(#110) table, and packets in the new connections are committed
in this table. There is no table-miss flow in this table.
Fixes #219