Skip to content

Commit

Permalink
[Windows] Support OF port state "down" when installing Pod forwarding…
Browse files Browse the repository at this point in the history
… rules (#6889)

On Windows, OVS has an issue which doesn't correctly update the port status
after an OpenFlow port is successfully installed. So OVS may send out PortStatus
message with Port state as LIND_DOWN, this issue doesn't impact on the datapath
forwarding.

This change is a workaround to ensure Pod's OpenFlow entries are installed as
long as the OpenFlow port is allocated.

Signed-off-by: Wenying Dong <[email protected]>
  • Loading branch information
wenyingd authored Dec 31, 2024
1 parent 0e9d0f0 commit 531d61f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions pkg/agent/cniserver/pod_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,26 @@ func (pc *podConfigurator) recordPodEvent(ifConfig *interfacestore.InterfaceConf
}

func (pc *podConfigurator) processPortStatusMessage(status *openflow15.PortStatus) {
// Update Pod OpenFlow entries only after the OpenFlow port state is live.
if status.Desc.State != openflow15.PS_LIVE {
ofPort := status.Desc.PortNo
state := status.Desc.State
// Update Pod OpenFlow entries only after the OpenFlow port state is live or down.
// Accepting Port state "openflow15.PS_LINK_DOWN" is a workaround for Windows OVS issue https://github.com/openvswitch/ovs-issues/issues/351.
// In which OVS does not correctly implement function netdev_windows_update_flags, so OVS doesn't update ifp_flags
// after a new OpenFlow port is successfully installed. Since this OVS issue doesn't have side impact on datapath
// packets forwarding, antrea-agent will ignore the bad state to ensure the Pod's OpenFlow entries are installed as
// long as the port number is allocated.
if state != openflow15.PS_LIVE && state != openflow15.PS_LINK_DOWN {
klog.InfoS("Ignoring the OVS port status message with undesired state", "ofPort", ofPort, "state", state)
return
}

if ofPort == 0 {
klog.InfoS("Ignoring the OVS port status message with undesired port number", "ofPort", ofPort, "state", state)
return
}

ovsPort := string(bytes.Trim(status.Desc.Name, "\x00"))
ofPort := status.Desc.PortNo
klog.InfoS("Processing OVS port status message", "ovsPort", ovsPort, "ofPort", ofPort, "state", state)

ifConfig, found := pc.ifaceStore.GetInterfaceByName(ovsPort)
if !found {
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/cniserver/pod_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ func TestProcessPortStatusMessage(t *testing.T) {
PortNo: 1,
Length: 72,
Name: []byte(fmt.Sprintf("%s\x00", podIfName)),
State: openflow15.PS_LINK_DOWN,
State: openflow15.PS_BLOCKED,
},
},
ovsPortName: podIfName,
Expand Down

0 comments on commit 531d61f

Please sign in to comment.