tuning: always update MAC in CNI result
Since the CNI Spec bump to v1.0 the tuning plugin no longer updates the mac address in the cni result for 0.4.0 or below configs. I don't think this ever worked when the cni result was converted to a different version. A test has been added to ensure it is working for all spec versions. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
This commit is contained in:
@ -145,7 +145,7 @@ func changeMacAddr(ifName string, newMacAddr string) error {
|
||||
return netlink.LinkSetHardwareAddr(link, addr)
|
||||
}
|
||||
|
||||
func updateResultsMacAddr(config TuningConf, ifName string, newMacAddr string) {
|
||||
func updateResultsMacAddr(config *TuningConf, ifName string, newMacAddr string) {
|
||||
// Parse previous result.
|
||||
if config.PrevResult == nil {
|
||||
return
|
||||
@ -159,6 +159,7 @@ func updateResultsMacAddr(config TuningConf, ifName string, newMacAddr string) {
|
||||
i.Mac = newMacAddr
|
||||
}
|
||||
}
|
||||
config.PrevResult = result
|
||||
}
|
||||
|
||||
func changePromisc(ifName string, val bool) error {
|
||||
@ -327,7 +328,7 @@ func cmdAdd(args *skel.CmdArgs) error {
|
||||
}
|
||||
}
|
||||
|
||||
updateResultsMacAddr(*tuningConf, args.IfName, tuningConf.Mac)
|
||||
updateResultsMacAddr(tuningConf, args.IfName, tuningConf.Mac)
|
||||
}
|
||||
|
||||
if tuningConf.Promisc != false {
|
||||
|
Reference in New Issue
Block a user