Skip to content

Commit

Permalink
[Windows] Set rewrite-MAC mark for NodePort Service packet (#948)
Browse files Browse the repository at this point in the history
Set the packet with rewrite-MAC mark if it enters OVS from bridge interface,
and targets at local Pods, so that the packet's dst MAC could be re-written
in L3Routing table with the correct value.
  • Loading branch information
wenyingd committed Jul 15, 2020
1 parent b63dc54 commit 21e3e83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/agent/openflow/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -968,12 +968,13 @@ func (c *client) bridgeAndUplinkFlows(uplinkOfport uint32, bridgeLocalPort uint3
Cookie(c.cookieAllocator.Request(category).Raw()).
Done(),
// Forward the packet to conntrackTable if it enters the OVS pipeline from the bridge interface and is sent to
// local Pods.
// local Pods. Set the packet with MAC rewrite mark, so that the dstMAC will be re-written with real MAC in
// the L3Routing table, and it could be forwarded to the valid OVS interface.
c.pipeline[ClassifierTable].BuildFlow(priorityHigh).
MatchProtocol(binding.ProtocolIP).
MatchInPort(bridgeLocalPort).
MatchDstIPNet(localSubnet).
Action().SetDstMAC(globalVirtualMAC).
Action().LoadRegRange(int(marksReg), macRewriteMark, macRewriteMarkRange).
Action().GotoTable(conntrackTable).
Cookie(c.cookieAllocator.Request(category).Raw()).
Done(),
Expand Down
2 changes: 1 addition & 1 deletion test/integration/agent/openflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ func prepareExternalFlows(nodeIP net.IP, localSubnet *net.IPNet) []expectTableFl
},
{
fmt.Sprintf("priority=210,ip,in_port=LOCAL,nw_dst=%s", localSubnet.String()),
"set_field:aa:bb:cc:dd:ee:ff->eth_dst,goto_table:30",
"load:0x1->NXM_NX_REG0[19],goto_table:30",
},
},
},
Expand Down

0 comments on commit 21e3e83

Please sign in to comment.