1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00
freebsd/sys/conf
Andre Oppermann 81d392a09d Improve SYN cookies by encoding the MSS, WSCALE (window scaling) and SACK
information into the ISN (initial sequence number) without the additional
use of timestamp bits and switching to the very fast and cryptographically
strong SipHash-2-4 MAC hash algorithm to protect the SYN cookie against
forgeries.

The purpose of SYN cookies is to encode all necessary session state in
the 32 bits of our initial sequence number to avoid storing any information
locally in memory.  This is especially important when under heavy spoofed
SYN attacks where we would either run out of memory or the syncache would
fill with bogus connection attempts swamping out legitimate connections.

The original SYN cookies method only stored an indexed MSS values in the
cookie.  This isn't sufficient anymore and breaks down in the presence of
WSCALE information which is only exchanged during SYN and SYN-ACK.  If we
can't keep track of it then we may severely underestimate the available
send or receive window. This is compounded with large windows whose size
information on the TCP segment header is even lower numerically.  A number
of years back SYN cookies were extended to store the additional state in
the TCP timestamp fields, if available on a connection.  While timestamps
are common among the BSD, Linux and other *nix systems Windows never enabled
them by default and thus are not present for the vast majority of clients
seen on the Internet.

The common parameters used on TCP sessions have changed quite a bit since
SYN cookies very invented some 17 years ago.  Today we have a lot more
bandwidth available making the use window scaling almost mandatory.  Also
SACK has become standard making recovering from packet loss much more
efficient.

This change moves all necessary information into the ISS removing the need
for timestamps.  Both the MSS (16 bits) and send WSCALE (4 bits) are stored
in 3 bit indexed form together with a single bit for SACK.  While this is
significantly less than the original range, it is sufficient to encode all
common values with minimal rounding.

The MSS depends on the MTU of the path and with the dominance of ethernet
the main value seen is around 1460 bytes.  Encapsulations for DSL lines
and some other overheads reduce it by a few more bytes for many connections
seen.  Rounding down to the next lower value in some cases isn't a problem
as we send only slightly more packets for the same amount of data.

The send WSCALE index is bit more tricky as rounding down under-estimates
the available send space available towards the remote host, however a small
number values dominate and are carefully selected again.

The receive WSCALE isn't encoded at all but recalculated based on the local
receive socket buffer size when a valid SYN cookie returns.  A listen socket
buffer size is unlikely to change while active.

The index values for MSS and WSCALE are selected for minimal rounding errors
based on large traffic surveys.  These values have to be periodically
validated against newer traffic surveys adjusting the arrays tcp_sc_msstab[]
and tcp_sc_wstab[] if necessary.

In addition the hash MAC to protect the SYN cookies is changed from MD5
to SipHash-2-4, a much faster and cryptographically secure algorithm.

Reviewed by:	dwmalone
Tested by:	Fabian Keil <fk@fabiankeil.de>
2013-07-11 15:29:25 +00:00
..
files Improve SYN cookies by encoding the MSS, WSCALE (window scaling) and SACK 2013-07-11 15:29:25 +00:00
files.amd64 Import HighPoint DC Series Data Center HBA (DC7280 and R750) driver. 2013-07-06 07:49:41 +00:00
files.arm - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
files.i386 Import HighPoint DC Series Data Center HBA (DC7280 and R750) driver. 2013-07-06 07:49:41 +00:00
files.ia64 - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
files.mips - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
files.pc98 - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
files.powerpc - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
files.sparc64 - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
kern.mk Spell extensions correctly. 2013-05-20 19:41:34 +00:00
kern.post.mk Remove the links: target. It too is homelessly outdated since it 2012-10-25 04:55:04 +00:00
kern.pre.mk Add the AR9300 HAL into the kernel and module builds. 2013-05-02 07:05:34 +00:00
kmod_syms.awk
kmod.mk amd64: use -mno-omit-leaf-frame-pointer in addition to -fno-omit-frame-pointer 2013-07-09 08:42:02 +00:00
ldscript.amd64
ldscript.arm Correctly align the unwind tables. Without this clang may incorrectly align 2013-03-10 00:47:19 +00:00
ldscript.i386
ldscript.ia64
ldscript.mips
ldscript.mips.cfe
ldscript.mips.mips64
ldscript.mips.octeon1
ldscript.powerpc
ldscript.powerpc64
ldscript.sparc64
Makefile.amd64 amd64: use -mno-omit-leaf-frame-pointer in addition to -fno-omit-frame-pointer 2013-07-09 08:42:02 +00:00
Makefile.arm The -mno-apcs-frame argument is unavaliable on clang, also ignore it there. 2013-03-17 00:56:17 +00:00
Makefile.i386 Add basic support for FDT to i386 & amd64. This change includes: 2013-05-21 03:05:49 +00:00
Makefile.ia64
Makefile.mips
Makefile.pc98 MFi386: r232263 2012-11-10 14:56:35 +00:00
Makefile.powerpc Remove duplication and centralize testing of various config(8)ed features. 2012-09-12 14:19:40 +00:00
Makefile.sparc64
makeLINT.mk Generate a LINT for powerpc and for powerpc64. 2013-04-11 22:18:20 +00:00
makeLINT.sed
newvers.sh - Update newvers.sh to include svn revision in uname(1) if the 2013-07-02 10:36:57 +00:00
NOTES - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
options Add an entry for filemon. 2013-07-03 20:22:12 +00:00
options.amd64 Rename the IVY_RNG option to RDRAND_RNG. 2012-09-13 10:12:16 +00:00
options.arm Port the new PV entry allocator from amd64/i386/mips to armv6/v7. 2013-05-14 09:47:58 +00:00
options.i386 Rename the IVY_RNG option to RDRAND_RNG. 2012-09-13 10:12:16 +00:00
options.ia64 Port the new PV entry allocator from amd64/i386. This allocator has two 2012-10-26 03:02:39 +00:00
options.mips Add an option for the GE FES based packet engines. Its board IDs 2013-04-23 09:40:42 +00:00
options.pc98
options.powerpc
options.sparc64 - While Netra X1 generally show no ill effects when registering a power 2013-03-02 00:37:31 +00:00
systags.sh
WITHOUT_SOURCELESS
WITHOUT_SOURCELESS_HOST Import HighPoint DC Series Data Center HBA (DC7280 and R750) driver. 2013-07-06 07:49:41 +00:00
WITHOUT_SOURCELESS_UCODE Adding urtwn(4) firmware and related changes. 2013-07-10 08:21:09 +00:00