From 1fd80eba4113cf162af08f238d192758acffa436 Mon Sep 17 00:00:00 2001 From: Laszlo Kiraly Date: Mon, 24 Jan 2022 15:58:15 +0100 Subject: [PATCH] Fix MAC address update based on Ethernet context for kernel mechanism #411 Signed-off-by: Laszlo Kiraly --- pkg/kernel/networkservice/ethernetcontext/vf_common.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/kernel/networkservice/ethernetcontext/vf_common.go b/pkg/kernel/networkservice/ethernetcontext/vf_common.go index b5748336..ca71192e 100644 --- a/pkg/kernel/networkservice/ethernetcontext/vf_common.go +++ b/pkg/kernel/networkservice/ethernetcontext/vf_common.go @@ -17,6 +17,7 @@ package ethernetcontext import ( + "bytes" "context" "net" "time" @@ -61,6 +62,9 @@ func setKernelHwAddress(ctx context.Context, conn *networkservice.Connection, is if err != nil { return errors.Wrapf(err, "invalid MAC address: %v", macAddrString) } + if bytes.Equal([]byte(macAddr), []byte(l.Attrs().HardwareAddr)) { + return nil + } if err = netlinkHandle.LinkSetDown(l); err != nil { return errors.WithStack(err) }