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

Make reject action work in AntreaIPAM mode #3003

Merged
merged 1 commit into from Nov 18, 2021

Conversation

GraysonWu
Copy link
Contributor

@GraysonWu GraysonWu commented Nov 8, 2021

Fixes issue #2979.

For this issue, after investigation, I noticed that only intra-Node Pod-to-Pod traffic with ingress reject policy will fail.
The root cause of this issue is that in AntreaIPAM mode, MAC addresses will always be re-written as srcMAC=localGatewayMAC, dstMAC=dstPodInterfaceMAC in L3ForwardingTable. https://github.com/antrea-io/antrea/blob/main/pkg/agent/openflow/pipeline.go#L1150-L1152.
Previous reject logic for intra-Node Pod-to-Pod case is that directly output the reject response to the OF port of the dstPod of the reject response. This could work for egress policies because the packet hasn't reached L3ForwardingTable. But for ingress policies, MAC addresses haven't re-written. The generated reject response will use localGatewayMAC as dstMAC. When the client receives this response, it won't treat it as a correct response to its request.

This PR changed the reject logic for Pod-to-Pod intra-Node case to resubmit the packet to L3ForwardingTable instead of directly output to an OF port. So in AntreaIPAM mode, L3ForwardingTable could re-write MAC addresses to a correct state. And it also can work when not in AntreaIPAM mode.

@GraysonWu
Copy link
Contributor Author

/test-flexible-ipam-e2e

@GraysonWu GraysonWu changed the title [WIP]Make reject action work in AntreaIPAM mode [Not4Review]Make reject action work in AntreaIPAM mode Nov 8, 2021
@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2021

Codecov Report

Merging #3003 (04a3614) into main (db0c92d) will decrease coverage by 0.82%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3003      +/-   ##
==========================================
- Coverage   60.61%   59.78%   -0.83%     
==========================================
  Files         292      292              
  Lines       24708    24709       +1     
==========================================
- Hits        14976    14772     -204     
- Misses       8092     8317     +225     
+ Partials     1640     1620      -20     
Flag Coverage Δ
kind-e2e-tests 46.84% <100.00%> (-0.91%) ⬇️
unit-tests 40.14% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/controller/networkpolicy/reject.go 87.90% <100.00%> (+9.85%) ⬆️
pkg/agent/util/net.go 16.32% <0.00%> (-22.45%) ⬇️
pkg/agent/route/route_linux.go 26.88% <0.00%> (-19.80%) ⬇️
pkg/agent/util/ipset/ipset.go 61.53% <0.00%> (-7.70%) ⬇️
pkg/util/k8s/client.go 46.34% <0.00%> (-4.88%) ⬇️
pkg/agent/openflow/pipeline.go 68.78% <0.00%> (-4.00%) ⬇️
pkg/agent/proxy/types/groupcounter.go 90.56% <0.00%> (-3.78%) ⬇️
pkg/controller/networkpolicy/store/addressgroup.go 83.01% <0.00%> (-3.78%) ⬇️
...kg/agent/flowexporter/connections/conntrack_ovs.go 76.36% <0.00%> (-3.04%) ⬇️
pkg/agent/proxy/proxier.go 57.43% <0.00%> (-2.78%) ⬇️
... and 11 more

@GraysonWu GraysonWu force-pushed the fix-reject-ipam branch 3 times, most recently from 6e4928b to ec0ec4f Compare November 9, 2021 23:35
@GraysonWu
Copy link
Contributor Author

/test-flexible-ipam-e2e

@GraysonWu
Copy link
Contributor Author

/test-flexible-ipam-e2e

@GraysonWu GraysonWu changed the title [Not4Review]Make reject action work in AntreaIPAM mode Make reject action work in AntreaIPAM mode Nov 11, 2021
@GraysonWu GraysonWu requested a review from tnqn November 11, 2021 23:06
@GraysonWu
Copy link
Contributor Author

/test-flexible-ipam-e2e

Signed-off-by: wgrayson <wgrayson@vmware.com>
@GraysonWu
Copy link
Contributor Author

/test-e2e
/test-ipv6-e2e
/test-ipv6-only-e2e
/test-windows-e2e
/test-flexible-ipam-e2e

@GraysonWu
Copy link
Contributor Author

/test-integration

Copy link
Contributor

@gran-vmv gran-vmv left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

@tnqn
Copy link
Member

tnqn commented Nov 18, 2021

/skip-conformance
/skip-networkpolicy

@tnqn
Copy link
Member

tnqn commented Nov 18, 2021

@GraysonWu "Fixes issue #xxx" won't close the issue automatically, please just write "Fixes #xxx" next time.

@GraysonWu
Copy link
Contributor Author

@GraysonWu "Fixes issue #xxx" won't close the issue automatically, please just write "Fixes #xxx" next time.

Got it. Thanks for reminding me.

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.

None yet

4 participants