Skip to content

Commit

Permalink
Merge pull request containernetworking#664 from edef1c/rand-read
Browse files Browse the repository at this point in the history
Use crypto/rand.Read, not crypto.Reader.Read
  • Loading branch information
matthewdupre authored Sep 22, 2021
2 parents a6b5412 + 90c0185 commit 2c46a72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/ip/link_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func makeVeth(name, vethPeerName string, mtu int, mac string, hostNS ns.NetNS) (
// RandomVethName returns string "veth" with random prefix (hashed from entropy)
func RandomVethName() (string, error) {
entropy := make([]byte, 4)
_, err := rand.Reader.Read(entropy)
_, err := rand.Read(entropy)
if err != nil {
return "", fmt.Errorf("failed to generate random veth name: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/testutils/netns_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewNS() (ns.NetNS, error) {
nsRunDir := getNsRunDir()

b := make([]byte, 16)
_, err := rand.Reader.Read(b)
_, err := rand.Read(b)
if err != nil {
return nil, fmt.Errorf("failed to generate random netns name: %v", err)
}
Expand Down

0 comments on commit 2c46a72

Please sign in to comment.