Skip to content

Commit

Permalink
[SecondaryNetwork] Fix agent crash if host interface is already attac…
Browse files Browse the repository at this point in the history
…hed to OVS bridge

PrepareHostInterfaceConnection should return the bridged interface name
if the host interface is already attached to the OVS bridge.

Signed-off-by: Xu Liu <[email protected]>
  • Loading branch information
xliuxu committed Sep 12, 2024
1 parent afdd261 commit 2815123
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/agent/util/net_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,12 @@ func PrepareHostInterfaceConnection(
// If the port already exists, just return.
if ofPort, err := bridge.GetOFPort(bridgedName, false); err == nil {
klog.InfoS("Port already exists, skip the configuration", "port", bridgedName, "ofPort", ofPort)
return "", true, nil
return bridgedName, true, nil
}

iface, ifaceIPs, ifaceRoutes, err := GetInterfaceConfig(ifaceName)
if err != nil {
return "", false, nil
return "", false, err
}

if err = RenameInterface(ifaceName, bridgedName); err != nil {
Expand Down

0 comments on commit 2815123

Please sign in to comment.