Skip to content

Commit

Permalink
fix link set error
Browse files Browse the repository at this point in the history
Signed-off-by: wangs <[email protected]>
  • Loading branch information
wangwangyusur288 committed Sep 4, 2024
1 parent dff85f2 commit f2e6827
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions pkg/daemon/gateway_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1437,15 +1437,25 @@ func (c *Controller) setExGateway() error {
klog.Error(err)
return err
}
link, err := netlink.LinkByName(linkName)

isUserspaceDP, err := ovs.IsUserspaceDataPath()
if err != nil {
klog.Errorf("failed to get nic %s, %v", linkName, err)
klog.Error(err)
return err
}
if err := netlink.LinkSetUp(link); err != nil {
klog.Errorf("failed to set gateway nic %s up, %v", linkName, err)
return err

if !isUserspaceDP {
link, err := netlink.LinkByName(linkName)
if err != nil {
klog.Errorf("failed to get nic %s, %v", linkName, err)
return err
}
if err := netlink.LinkSetUp(link); err != nil {
klog.Errorf("failed to set gateway nic %s up, %v", linkName, err)
return err
}
}

externalBrReady := false
// if external nic already attached into another bridge
if existBr, err := ovs.Exec("port-to-br", linkName); err == nil {
Expand Down

0 comments on commit f2e6827

Please sign in to comment.