public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] tcp: randomize TCP source ports
@ 2013-11-08  0:54 Eric Dumazet
  2013-11-08  1:07 ` Rick Jones
  2013-11-08 13:02 ` Hannes Frederic Sowa
  0 siblings, 2 replies; 15+ messages in thread
From: Eric Dumazet @ 2013-11-08  0:54 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

TCP does proper randomization of ports on active connections only if
bind() is used between socket() and connect()

If bind() is not specifically used, kernel performs autobind, and TCP
autobind typically uses a sequential allocation for a given (dst
address, dst port, src address) tuple.

UDP autobind does a randomization, as part of the effort to make DNS
more secure.

TCP autobind uses a global sequential number (called @hint in source
code) with a perturbation done by secure_ipv4_port_ephemeral(),
 so that the 'hint' of the next port is per (saddr, daddr, dport) tuple

This was probably done to maximize port use and avoid hitting timewait
sockets, but I think it should be OK to replace this stuff by a random
selection to have more entropy in the various flow hashing functions,
and in general higher security levels. TCP timestamps are now well
deployed.

Patch would be trivial, but I'd like to get some comments if
you think this idea is wrong.

Thanks !

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-11-09 20:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-08  0:54 [RFC] tcp: randomize TCP source ports Eric Dumazet
2013-11-08  1:07 ` Rick Jones
2013-11-08  2:04   ` Eric Dumazet
2013-11-08 23:26     ` Rick Jones
2013-11-08 23:42       ` Eric Dumazet
2013-11-08 23:57         ` Rick Jones
2013-11-08 13:02 ` Hannes Frederic Sowa
2013-11-08 14:03   ` Eric Dumazet
2013-11-08 14:28     ` Hannes Frederic Sowa
2013-11-08 15:11       ` Eric Dumazet
2013-11-08 17:39         ` Hannes Frederic Sowa
2013-11-09  4:47         ` Hannes Frederic Sowa
2013-11-09 15:26           ` Loganaden Velvindron
2013-11-09 18:16           ` Daniel Borkmann
2013-11-09 20:54             ` Hannes Frederic Sowa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox