Skip to content

Commit

Permalink
Add IPv6 flow for traceflowConnectionTrackFlows
Browse files Browse the repository at this point in the history
  • Loading branch information
jianjuns committed Apr 9, 2021
1 parent 6f25769 commit ffc4031
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions pkg/agent/openflow/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,31 +705,32 @@ func (c *client) kubeProxyFlows(category cookie.Category) []binding.Flow {
func (c *client) traceflowConnectionTrackFlows(dataplaneTag uint8, packet *binding.Packet, srcOFPort uint32, timeout uint16, category cookie.Category) []binding.Flow {
connectionTrackStateTable := c.pipeline[conntrackStateTable]
var flows []binding.Flow

if packet == nil {
flowBuilder := connectionTrackStateTable.BuildFlow(priorityLow + 1).
MatchProtocol(binding.ProtocolIP).
MatchIPDSCP(dataplaneTag).
SetHardTimeout(timeout).
Cookie(c.cookieAllocator.Request(category).Raw())
if c.enableProxy {
flowBuilder = flowBuilder.
Action().ResubmitToTable(sessionAffinityTable).
Action().ResubmitToTable(serviceLBTable)
} else {
flowBuilder = flowBuilder.
Action().ResubmitToTable(connectionTrackStateTable.GetNext())
}
flows = append(flows, flowBuilder.Done())
for _, ipProtocol := range c.ipProtocols {
flowBuilder := connectionTrackStateTable.BuildFlow(priorityLow + 1).
MatchProtocol(ipProtocol).
MatchIPDSCP(dataplaneTag).
SetHardTimeout(timeout).
Cookie(c.cookieAllocator.Request(category).Raw())
if c.enableProxy {
flowBuilder = flowBuilder.
Action().ResubmitToTable(sessionAffinityTable).
Action().ResubmitToTable(serviceLBTable)
} else {
flowBuilder = flowBuilder.
Action().ResubmitToTable(connectionTrackStateTable.GetNext())
}
flows = append(flows, flowBuilder.Done())

flows = append(flows, connectionTrackStateTable.BuildFlow(priorityLow+2).
MatchProtocol(binding.ProtocolIP).
MatchIPDSCP(dataplaneTag).
MatchCTStateTrk(true).MatchCTStateRpl(true).
SetHardTimeout(timeout).
Cookie(c.cookieAllocator.Request(category).Raw()).
Action().Drop().
Done())
flows = append(flows, connectionTrackStateTable.BuildFlow(priorityLow+2).
MatchProtocol(binding.ProtocolIP).
MatchIPDSCP(dataplaneTag).
MatchCTStateTrk(true).MatchCTStateRpl(true).
SetHardTimeout(timeout).
Cookie(c.cookieAllocator.Request(category).Raw()).
Action().Drop().
Done())
}
} else {
flowBuilder := connectionTrackStateTable.BuildFlow(priorityLow).
MatchInPort(srcOFPort).
Expand Down Expand Up @@ -937,7 +938,7 @@ func (c *client) l2ForwardCalcFlow(dstMAC net.HardwareAddr, ofPort uint32, skipI
func (c *client) traceflowL2ForwardOutputFlows(dataplaneTag uint8, liveTraffic bool, timeout uint16, category cookie.Category) []binding.Flow {
flows := []binding.Flow{}
l2FwdOutTable := c.pipeline[L2ForwardingOutTable]
for _, ipProtocol := range []binding.Protocol{binding.ProtocolIP, binding.ProtocolIPv6} {
for _, ipProtocol := range c.ipProtocols {
if c.encapMode.SupportsEncap() {
// SendToController and Output if output port is tunnel port.
flows = append(flows, l2FwdOutTable.BuildFlow(priorityNormal+3).
Expand Down

0 comments on commit ffc4031

Please sign in to comment.