Skip to content

Commit

Permalink
pktsock: use math.Rand over crypto.Rand
Browse files Browse the repository at this point in the history
This prevents blocking until the CRNG is initialized with Linux ≥ 4.16:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=43838a23a05fbd13e47d750d3dfd77001536dd33

Randomness is used to fill the IPv4 ID field. As per
https://tools.ietf.org/html/rfc6864, the ID field is used only for
fragmentation, but DHCP packets are never fragmented. Even if they were, the
randomness does not need to be cryptographically secure.
  • Loading branch information
stapelberg committed Jun 8, 2018
1 parent 30bb0ed commit 58c4d7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pktsock_linux.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dhcp4client

import (
"crypto/rand"
"encoding/binary"
"math/rand"
"net"
"time"

Expand Down

0 comments on commit 58c4d7a

Please sign in to comment.