aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/datagram.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2019-11-01 10:32:19 -0700
committerDavid S. Miller <davem@davemloft.net>2019-11-01 14:57:52 -0700
commita904a0693c189691eeee64f6c6b188bd7dc244e9 (patch)
tree393398816e62514323b428a7141d1d1bcecd73fa /net/ipv4/datagram.c
parentMerge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue (diff)
downloadlinux-dev-a904a0693c189691eeee64f6c6b188bd7dc244e9.tar.xz
linux-dev-a904a0693c189691eeee64f6c6b188bd7dc244e9.zip
inet: stop leaking jiffies on the wire
Historically linux tried to stick to RFC 791, 1122, 2003 for IPv4 ID field generation. RFC 6864 made clear that no matter how hard we try, we can not ensure unicity of IP ID within maximum lifetime for all datagrams with a given source address/destination address/protocol tuple. Linux uses a per socket inet generator (inet_id), initialized at connection startup with a XOR of 'jiffies' and other fields that appear clear on the wire. Thiemo Nagel pointed that this strategy is a privacy concern as this provides 16 bits of entropy to fingerprint devices. Let's switch to a random starting point, this is just as good as far as RFC 6864 is concerned and does not leak anything critical. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Thiemo Nagel <tnagel@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/datagram.c')
-rw-r--r--net/ipv4/datagram.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c
index 9a0fe0c2fa02..4a8550c49202 100644
--- a/net/ipv4/datagram.c
+++ b/net/ipv4/datagram.c
@@ -73,7 +73,7 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
reuseport_has_conns(sk, true);
sk->sk_state = TCP_ESTABLISHED;
sk_set_txhash(sk);
- inet->inet_id = jiffies;
+ inet->inet_id = prandom_u32();
sk_dst_set(sk, &rt->dst);
err = 0;