Skip to content

Commit 88cdd84

Browse files
committed
Seed the random number generator
Ensure operations calling randomMACAddress data get a random MAC address, calls were providing the same mac address in multiple environments and as a result getting the same IP address if not isolated.
1 parent 6536f78 commit 88cdd84

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

libvirt/utils_net.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
// with libvirt prefix
2020
func randomMACAddress() (string, error) {
2121
buf := make([]byte, 3)
22+
rand.Seed(time.Now().UnixNano())
2223
_, err := rand.Read(buf)
2324
if err != nil {
2425
return "", err

0 commit comments

Comments
 (0)