Skip to content

Commit

Permalink
[multicast] fix the issue multicast does not work if antreaPolicy is …
Browse files Browse the repository at this point in the history
…disabled

Currently, packetIn reason only supports 0 and 1. There is no more available packetIn reasons
as traceflow and antreaPolicy use both. Multicast reuses packetIn reason with antreaPolicy, and
uses a different register bit to indicate the real reason. There is no queue for packetIn reason
'PacketInReasonNP' if antreaPloicy is disabled. And multicast will not work then.

This patch fixes #3808

Signed-off-by: Bin Liu <biliu@vmware.com>
  • Loading branch information
liu4480 committed May 18, 2022
1 parent 3a51abe commit 189fe7d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
13 changes: 2 additions & 11 deletions cmd/antrea-agent/agent.go
Expand Up @@ -633,17 +633,8 @@ func run(o *Options) error {
}
go apiServer.Run(stopCh)

// Start PacketIn for features and specify their own reason.
var packetInReasons []uint8
if features.DefaultFeatureGate.Enabled(features.Traceflow) {
packetInReasons = append(packetInReasons, uint8(openflow.PacketInReasonTF))
}
if features.DefaultFeatureGate.Enabled(features.AntreaPolicy) {
packetInReasons = append(packetInReasons, uint8(openflow.PacketInReasonNP))
}
if len(packetInReasons) > 0 {
go ofClient.StartPacketInHandler(packetInReasons, stopCh)
}
// Start PacketIn
go ofClient.StartPacketInHandler(stopCh)

// Start the goroutine to periodically export IPFIX flow records.
if features.DefaultFeatureGate.Enabled(features.FlowExporter) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/openflow/client.go
Expand Up @@ -215,7 +215,7 @@ type Client interface {
// packets through registered handlers.
RegisterPacketInHandler(packetHandlerReason uint8, packetHandlerName string, packetInHandler interface{})

StartPacketInHandler(packetInStartedReason []uint8, stopCh <-chan struct{})
StartPacketInHandler(stopCh <-chan struct{})
// Get traffic metrics of each NetworkPolicy rule.
NetworkPolicyMetrics() map[uint32]*types.RuleMetric
// SendTCPPacketOut sends TCP packet as a packet-out to OVS.
Expand Down
6 changes: 3 additions & 3 deletions pkg/agent/openflow/packetin.go
Expand Up @@ -84,13 +84,13 @@ func newfeatureStartPacketIn(reason uint8, stopCh <-chan struct{}) *featureStart
}

// StartPacketInHandler is the starting point for processing feature packetin requests.
func (c *client) StartPacketInHandler(packetInStartedReason []uint8, stopCh <-chan struct{}) {
if len(c.packetInHandlers) == 0 || len(packetInStartedReason) == 0 {
func (c *client) StartPacketInHandler(stopCh <-chan struct{}) {
if len(c.packetInHandlers) == 0 {
return
}

// Iterate through each feature that starts packetin. Subscribe with their specified reason.
for _, reason := range packetInStartedReason {
for reason := range c.packetInHandlers {
featurePacketIn := newfeatureStartPacketIn(reason, stopCh)
err := c.subscribeFeaturePacketIn(featurePacketIn)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions pkg/agent/openflow/testing/mock_openflow.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 189fe7d

Please sign in to comment.