Skip to content

Commit

Permalink
[Windows] Use uplink MAC as source if packet is output to uplink (#3516)
Browse files Browse the repository at this point in the history
With noEncap mode the Pod packet to remote Pod/Node is output to the
uplink interface directly. This change modifies the source MAC with the
uplink interface's MAC, so that it doesn't require hybrid configurations
on the host interface.

Signed-off-by: wenyingd <wenyingd@vmware.com>
  • Loading branch information
wenyingd authored Mar 25, 2022
1 parent f0c3cbe commit b283f2d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/agent/agent_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func (i *Initializer) prepareHostNetwork() error {
}
// Save the uplink adapter name to check if the OVS uplink port has been created in prepareOVSBridge stage.
i.nodeConfig.UplinkNetConfig.Name = hnsNetwork.NetworkAdapterName

// Save the uplink adapter MAC to modify Pod traffic source MAC if the packet is directly output to the uplink
// interface in OVS pipeline.
i.nodeConfig.UplinkNetConfig.MAC, _ = net.ParseMAC(hnsNetwork.SourceMac)
return nil
}
if _, ok := err.(hcsshim.NetworkNotFoundError); !ok {
Expand Down
1 change: 1 addition & 0 deletions pkg/agent/openflow/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ func (f *featurePodConnectivity) l3FwdFlowToRemoteViaUplink(remoteGatewayMAC net
MatchProtocol(ipProtocol).
MatchRegMark(NotAntreaFlexibleIPAMRegMark).
MatchDstIPNet(peerSubnet).
Action().SetSrcMAC(f.nodeConfig.UplinkNetConfig.MAC).
Action().SetDstMAC(remoteGatewayMAC).
Action().GotoTable(L3DecTTLTable.GetID()).
Done()
Expand Down
1 change: 1 addition & 0 deletions pkg/agent/openflow/pipeline_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func (f *featurePodConnectivity) l3FwdFlowToRemoteViaRouting(localGatewayMAC net
MatchDstIP(peerIP).
MatchCTStateRpl(true).
MatchCTStateTrk(true).
Action().SetSrcMAC(f.nodeConfig.UplinkNetConfig.MAC).
Action().SetDstMAC(remoteGatewayMAC).
Action().NextTable().
Done(),
Expand Down

0 comments on commit b283f2d

Please sign in to comment.