Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/daemon/ovs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,15 @@ func configureNodeNic(cs kubernetes.Interface, nodeName, portName, ip, gw, joinC
return fmt.Errorf("can not find nic %s: %w", util.NodeNic, err)
}

actualMac := hostLink.Attrs().HardwareAddr
if actualMac.String() != macAddr.String() {
macAddr = actualMac
err := fmt.Errorf("MAC address mismatch on %s: expected %s, actual %s", util.NodeNic, macAddr.String(), actualMac.String())
klog.Error(err)
return err
}
Comment on lines +673 to +678
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error message for the MAC address mismatch is incorrect because the macAddr variable is reassigned before the error string is formatted. This results in the 'expected' and 'actual' MAC addresses in the log message being identical, which is misleading and hinders debugging. The reassignment of macAddr is also unnecessary as the function returns immediately after.

	if actualMac.String() != macAddr.String() {
		err := fmt.Errorf("MAC address mismatch on %s: expected %s, actual %s", util.NodeNic, macAddr.String(), actualMac.String())
		klog.Error(err)
		return err
	}

klog.Infof("MAC address %s successfully set on %s", macAddr.String(), util.NodeNic)

if err = netlink.LinkSetTxQLen(hostLink, 1000); err != nil {
return fmt.Errorf("can not set host nic %s qlen: %w", util.NodeNic, err)
}
Expand Down
Loading