@@ -786,7 +786,7 @@ func networkSRIOVSetupVF(d deviceCommon, vfParent string, vfDevice string, vfID
786
786
}
787
787
788
788
// Now that MAC is set on VF, we can enable spoof checking.
789
- err = link .SetVfSpoofchk (volatile ["last_state.vf.id" ], "on" )
789
+ err = link .SetVfSpoofchk (volatile ["last_state.vf.id" ], true )
790
790
if err != nil {
791
791
return vfPCIDev , 0 , fmt .Errorf ("Failed enabling spoof check for VF %q: %w" , volatile ["last_state.vf.id" ], err )
792
792
}
@@ -799,7 +799,7 @@ func networkSRIOVSetupVF(d deviceCommon, vfParent string, vfDevice string, vfID
799
799
800
800
if useSpoofCheck {
801
801
// Ensure spoof checking is disabled if not enabled in instance (only for real VF).
802
- err = link .SetVfSpoofchk (volatile ["last_state.vf.id" ], "off" )
802
+ err = link .SetVfSpoofchk (volatile ["last_state.vf.id" ], false )
803
803
if err != nil {
804
804
return vfPCIDev , 0 , fmt .Errorf ("Failed disabling spoof check for VF %q: %w" , volatile ["last_state.vf.id" ], err )
805
805
}
@@ -912,13 +912,8 @@ func networkSRIOVRestoreVF(d deviceCommon, useSpoofCheck bool, volatile map[stri
912
912
// Reset VF MAC spoofing protection if recorded. Do this first before resetting the MAC
913
913
// to avoid any issues with zero MACs refusing to be set whilst spoof check is on.
914
914
if useSpoofCheck && volatile ["last_state.vf.spoofcheck" ] != "" {
915
- mode := "off"
916
- if util .IsTrue (volatile ["last_state.vf.spoofcheck" ]) {
917
- mode = "on"
918
- }
919
-
920
915
link := & ip.Link {Name : parent }
921
- err := link .SetVfSpoofchk (volatile ["last_state.vf.id" ], mode )
916
+ err := link .SetVfSpoofchk (volatile ["last_state.vf.id" ], util . IsTrue ( volatile [ "last_state.vf.spoofcheck" ]) )
922
917
if err != nil {
923
918
return err
924
919
}
0 commit comments