m/n/c/network: return original links
Do not recreate the netlink device structure as it loses information by
doing so, breaking things like DHCP which rely on for example the link
HwAddr. We already have proper *netlink.Device structures as they get
type-asserted anyways.
Change-Id: I90b8b6078fd7d6bd4e9e11e54751132bce22b517
Reviewed-on: https://review.monogon.dev/c/monogon/+/3112
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/metropolis/node/core/network/static.go b/metropolis/node/core/network/static.go
index abe9aca..1671884 100644
--- a/metropolis/node/core/network/static.go
+++ b/metropolis/node/core/network/static.go
@@ -325,11 +325,7 @@
if len(matchedDevices) <= int(it.Device.Index) || it.Device.Index < 0 {
return nil, fmt.Errorf("there are %d matching host devices but requested device index is %d", len(matchedDevices), it.Device.Index)
}
- dev := &netlink.Device{
- LinkAttrs: netlink.NewLinkAttrs(),
- }
- dev.Index = matchedDevices[it.Device.Index].Index
- return dev, nil
+ return matchedDevices[it.Device.Index], nil
}
var lacpRateMap = map[netpb.Bond_LACP_Rate]netlink.BondLacpRate{