Skip to content

Commit

Permalink
introduce a recheck for the VF interface name
Browse files Browse the repository at this point in the history
It's possible to have a race in the VFIsReady function.
vf netdevice can have a default eth0 device name and be the time
we call the netlink syscall to get the device information eth0
can be a different device.

this cause duplicate mac allocation on vf admin mac address

Signed-off-by: Sebastian Sch <sebassch@gmail.com>
  • Loading branch information
SchSeba committed Jun 20, 2024
1 parent ddb57f3 commit 632c827
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/host/internal/sriov/sriov.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,12 @@ func (s *sriov) VFIsReady(pciAddr string) (netlink.Link, error) {
vfLink, err = s.netlinkLib.LinkByName(vfName)
if err != nil {
log.Log.Error(err, "VFIsReady(): unable to get VF link", "device", pciAddr)
return false, nil
}
return err == nil, nil

// try to get the interface name again and check if the name changed
vfName = s.networkHelper.TryGetInterfaceName(pciAddr)
return vfName == vfLink.Attrs().Name, nil
})
if err != nil {
return vfLink, err
Expand Down

0 comments on commit 632c827

Please sign in to comment.