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

Implement traffic control interfaces via OVS #3580

Merged
merged 1 commit into from May 5, 2022

Conversation

hongliangl
Copy link
Contributor

@hongliangl hongliangl commented Apr 2, 2022

Signed-off-by: Hongliang Liu lhongliang@vmware.com

For #3324

@hongliangl hongliangl changed the title Add IDS/IPS support in data path. [WIP] Add IDS/IPS support in data path. Apr 2, 2022
@hongliangl hongliangl changed the title [WIP] Add IDS/IPS support in data path. [WIP] Add IDS/IPS support in data path Apr 2, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 2, 2022

Codecov Report

Merging #3580 (e984e42) into main (00f9d98) will decrease coverage by 0.88%.
The diff coverage is 9.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3580      +/-   ##
==========================================
- Coverage   64.58%   63.70%   -0.89%     
==========================================
  Files         278      278              
  Lines       39517    39604      +87     
==========================================
- Hits        25523    25229     -294     
- Misses      12011    12428     +417     
+ Partials     1983     1947      -36     
Flag Coverage Δ
e2e-tests 50.13% <9.09%> (?)
kind-e2e-tests 50.51% <9.09%> (-1.75%) ⬇️
unit-tests 43.73% <8.08%> (-0.06%) ⬇️

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

Impacted Files Coverage Δ
pkg/agent/openflow/framework.go 87.00% <0.00%> (-2.70%) ⬇️
pkg/agent/openflow/pod_connectivity.go 42.26% <5.79%> (-26.06%) ⬇️
pkg/agent/openflow/client.go 70.70% <8.33%> (-1.64%) ⬇️
pkg/agent/openflow/pipeline.go 72.54% <100.00%> (-2.35%) ⬇️
pkg/controller/egress/store/egressgroup.go 1.72% <0.00%> (-54.32%) ⬇️
pkg/agent/route/route_linux.go 30.17% <0.00%> (-19.63%) ⬇️
pkg/agent/util/net.go 32.44% <0.00%> (-19.12%) ⬇️
pkg/agent/nodeportlocal/k8s/annotations.go 84.44% <0.00%> (-8.89%) ⬇️
pkg/agent/util/ipset/ipset.go 59.45% <0.00%> (-8.11%) ⬇️
pkg/agent/openflow/service.go 78.16% <0.00%> (-5.75%) ⬇️
... and 22 more

@hongliangl hongliangl force-pushed the antrea-l7-datapath branch 3 times, most recently from 8a55b2f to 9f6ca48 Compare April 6, 2022 23:57
@hongliangl hongliangl added this to the Antrea v1.7 release milestone Apr 8, 2022
@hongliangl hongliangl added the action/release-note Indicates a PR that should be included in release notes. label Apr 8, 2022
@hongliangl hongliangl changed the title [WIP] Add IDS/IPS support in data path [WIP] Add third-party engine traffic scan support in data path Apr 8, 2022
@hongliangl hongliangl changed the title [WIP] Add third-party engine traffic scan support in data path [WIP] Implement traffic control interfaces via OVS Apr 8, 2022
@hongliangl
Copy link
Contributor Author

Before merging this PR, issue #3583 should be fixed.

@hongliangl hongliangl marked this pull request as ready for review April 9, 2022 05:07
@hongliangl hongliangl changed the title [WIP] Implement traffic control interfaces via OVS Implement traffic control interfaces via OVS Apr 9, 2022
@hongliangl hongliangl requested a review from jianjuns April 9, 2022 05:07
Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

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

Please add commit message to describe the change.

pkg/ovs/openflow/interfaces.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/client.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pod_connectivity.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pod_connectivity.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pod_connectivity.go Outdated Show resolved Hide resolved
@hongliangl hongliangl force-pushed the antrea-l7-datapath branch 3 times, most recently from 2f28158 to b8c30d6 Compare April 12, 2022 04:51
@hongliangl hongliangl force-pushed the antrea-l7-datapath branch 2 times, most recently from 1333d66 to e630e13 Compare April 12, 2022 09:52
pkg/agent/openflow/fields.go Outdated Show resolved Hide resolved
pkg/agent/openflow/fields.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
@hongliangl hongliangl force-pushed the antrea-l7-datapath branch 2 times, most recently from 365f341 to db3e5f6 Compare April 12, 2022 16:20
pkg/agent/openflow/client.go Outdated Show resolved Hide resolved
pkg/agent/openflow/client.go Outdated Show resolved Hide resolved
@hongliangl hongliangl requested a review from tnqn April 27, 2022 13:08
@hongliangl hongliangl force-pushed the antrea-l7-datapath branch 3 times, most recently from 04d3598 to bde339f Compare April 27, 2022 13:14
pkg/agent/openflow/pod_connectivity.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pod_connectivity.go Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
@hongliangl hongliangl force-pushed the antrea-l7-datapath branch 2 times, most recently from fd7c42c to 276ffde Compare April 27, 2022 15:51
@hongliangl hongliangl requested a review from tnqn April 27, 2022 15:53
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 overall

pkg/agent/openflow/fields.go Outdated Show resolved Hide resolved
test/integration/agent/openflow_test.go Show resolved Hide resolved
pkg/agent/openflow/fields.go Outdated Show resolved Hide resolved
pkg/agent/openflow/fields.go Outdated Show resolved Hide resolved
Action().OutputToRegField(TrafficControlTargetOFPortField).
Done(),
// This generates the flow to output the packets to be redirected to the target traffic control port.
L2ForwardingOutTable.ofTable.BuildFlow(priorityHigh+1).
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: A packet is either mirrored or redirected, but not both mirrored and redirected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A packet should be either mirrored or redirected.

cacheKey := fmt.Sprintf("tc_%s", name)
c.replayMutex.RLock()
defer c.replayMutex.RUnlock()
return c.modifyFlows(c.featurePodConnectivity.tcCachedFlows, cacheKey, flows)
Copy link
Contributor

@wenyingd wenyingd Apr 28, 2022

Choose a reason for hiding this comment

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

Using modifyFlows, it might delete the original tc flows which are not included in the flows generated by this call. I think your target is to append these flows in the cache but not overwrite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since a traffic rule could be updated, the original tc flows should be deleted and new flows should be installed. Flows in the cache should be also overwritten.

Copy link
Contributor

Choose a reason for hiding this comment

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

So do you mean InstallTrafficControlMarkFlows is called for both add and update case? And UninstallTrafficControlMarkFlows is called only when delete the tc configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Cookie(f.cookieAllocator.Request(f.category).Raw()).
MatchInPort(returnOFPort).
Action().LoadRegMark(FromTCReturnRegMark).
Action().GotoStage(stageRouting).
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not go to stageSwitching since the dst MAC in the packet is set before output to the redirected port?

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'll update the comments here

// trafficControlReturnClassifierFlow generates the flow to mark the packets from traffic control return port and forward
// the packets to stageRouting directly. Note that, for the packets which are originally to be output to a tunnel port,
// value of NXM_NX_TUN_IPV4_DST for the returned packets needs to be loaded in stageRouting.

Signed-off-by: Hongliang Liu <lhongliang@vmware.com>
@hongliangl
Copy link
Contributor Author

/test-all-features-conformance
/test-conformance
/test-e2e
/test-flexible-ipam-e2e
/test-ipv6-conformance
/test-ipv6-e2e
/test-ipv6-networkpolicy
/test-ipv6-only-conformance
/test-ipv6-only-e2e
/test-ipv6-only-networkpolicy
/test-multicluster-e2e
/test-networkpolicy
/test-windows-conformance
/test-windows-e2e
/test-windows-networkpolicy
/test-windows-proxyall-e2e
/test-integration

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, thanks

@hongliangl
Copy link
Contributor Author

/test-ipv6-e2e
/test-ipv6-only-conformance

@hongliangl
Copy link
Contributor Author

/test-ipv6-only-conformance

@hongliangl
Copy link
Contributor Author

/test-ipv6-e2e

@hongliangl
Copy link
Contributor Author

@jianjuns @wenyingd Do you have any further comments? Thanks.

@jianjuns
Copy link
Contributor

@jianjuns @wenyingd Do you have any further comments? Thanks.
Not from me (I did go through one more time).

@tnqn
Copy link
Member

tnqn commented May 5, 2022

tested the PR with a network analyzer and both mirroring and redirecting worked as expected, merging it.

@tnqn tnqn merged commit 0d9a4b1 into antrea-io:main May 5, 2022
@hongliangl
Copy link
Contributor Author

Thanks for testing and merging this.

@hongliangl hongliangl deleted the antrea-l7-datapath branch May 5, 2022 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants