Skip to content

Commit

Permalink
fix: make processing of mac addresses case insensitive
Browse files Browse the repository at this point in the history
Closes: vmware#2509
  • Loading branch information
rconde01 committed Jul 5, 2021
1 parent 5dace81 commit f6cd1b1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions object/virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"net"
"path"
"strings"

"github.com/vmware/govmomi/nfc"
"github.com/vmware/govmomi/property"
Expand Down Expand Up @@ -333,7 +334,9 @@ func (v VirtualMachine) WaitForNetIP(ctx context.Context, v4 bool, device ...str
devices := VirtualDeviceList(c.Val.(types.ArrayOfVirtualDevice).VirtualDevice)
for _, d := range devices {
if nic, ok := d.(types.BaseVirtualEthernetCard); ok {
mac := nic.GetVirtualEthernetCard().MacAddress
// Convert to lower so that e.g. 00:50:56:83:3A:5D is treated the
// same as 00:50:56:83:3a:5d
mac := strings.ToLower(nic.GetVirtualEthernetCard().MacAddress)
if mac == "" {
return false
}
Expand Down Expand Up @@ -369,7 +372,9 @@ func (v VirtualMachine) WaitForNetIP(ctx context.Context, v4 bool, device ...str

nics := c.Val.(types.ArrayOfGuestNicInfo).GuestNicInfo
for _, nic := range nics {
mac := nic.MacAddress
// Convert to lower so that e.g. 00:50:56:83:3A:5D is treated the
// same as 00:50:56:83:3a:5d
mac := strings.ToLower(nic.MacAddress)
if mac == "" || nic.IpConfig == nil {
continue
}
Expand Down

0 comments on commit f6cd1b1

Please sign in to comment.