Skip to content

RFC Generic TCP-option framework and adoption for TCP-SMC and TCP-MD5

Christoph Paasch netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest14 patches 3 repliesIn review
  2. v1 RFC14 patches 2 repliesSuperseded

Changes in v2 from the cover letter

* Some minor fixes thanks to the buildbot when certain configs are disabled (Patch 5 and 12)
* Add spdx-header in the new files (Patch 11)
* Added Ivan Delande to the CC-list as he did some TCP-MD5 changes in the past.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14tcp: Write options after the header has been fully donenet/ipv4/tcp_output.c+2 -20 replies
2/14tcp: Pass sock and skb to tcp_options_writenet/ipv4/tcp_output.c+7 -31 reply
3/14tcp: Allow tcp_fast_parse_options to drop segmentsnet/ipv4/tcp_input.c+10 -50 replies
4/14tcp_smc: Make smc_parse_options return 1 on successnet/ipv4/tcp_input.c+8 -50 replies
5/14tcp: Register handlers for extra TCP optionsdrivers/infiniband/hw/cxgb4/cm.c include/linux/tcp.h include/net/tcp.h +8 more+677 -550 replies
6/14tcp_smc: Make SMC use TCP extra-option frameworkinclude/linux/tcp.h include/net/inet_sock.h include/net/tcp.h +5 more+186 -1270 replies
7/14tcp_md5: Don't pass along md5-keyinclude/linux/tcp.h net/ipv4/tcp_output.c+20 -270 replies
8/14tcp_md5: Detect key inside tcp_v4_send_ack instead of passing it as an argumentnet/ipv4/tcp_ipv4.c+14 -40 replies
9/14tcp_md5: Detect key inside tcp_v6_send_response instead of passing it as an argumentnet/ipv6/tcp_ipv6.c+57 -620 replies
10/14tcp_md5: Check for TCP_MD5 after TCP Timestamps in tcp_established_optionsnet/ipv4/tcp_output.c+7 -70 replies
11/14tcp_md5: Move TCP-MD5 code out of TCP itselfinclude/linux/inet_diag.h include/linux/tcp_md5.h include/net/tcp.h +9 more+1304 -11320 replies
12/14tcp_md5: Use tcp_extra_options in output pathinclude/linux/tcp.h include/linux/tcp_md5.h net/ipv4/tcp_ipv4.c +4 more+487 -4380 replies
13/14tcp_md5: Cleanup TCP-codeinclude/linux/tcp.h include/linux/tcp_md5.h include/net/tcp.h +4 more+155 -2590 replies
14/14tcp_md5: Use TCP extra-options on the input pathinclude/linux/tcp_md5.h net/ipv4/tcp_input.c net/ipv4/tcp_ipv4.c +2 more+25 -530 replies

Reviews trailers per patch

13 of 14 patches have a Reviewed-by or Acked-by.

PatchMat Martineau
1/14R-b
2/14R-b
3/14R-b
4/14R-b
5/14
6/14R-b
7/14R-b
8/14R-b
9/14R-b
10/14R-b
11/14R-b
12/14R-b
13/14R-b
14/14R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RFC v2 00/14] Generic TCP-option framework and adoption for TCP-SMC and TCP-MD5

Resubmit as v2 RFC to get some feedback before net-next opens up again. Only minor changes (see below).

This patchset introduces a generic framework for handling TCP-options.

TCP-options like TCP_MD5 and SMC are rather rare use-cases, but their implementation is rather intrusive to the TCP-stack. Other, more recent TCP extensions like TCP-crypt, MPTCP or TCP-AO would make this situation even worse.

This new framework allows to add these TCP-options in a modular way. Writing, reading and acting upon these options is done through callbacks that get registered to a TCP-socket. A TCP-socket has a list of "extra" TCP-options that it will use.

We make TCP-SMC and TCP-MD5SIG adopt this new framework. As can be seen, there is now no more TCP-SMC code in the TCP-files and the TCP-MD5 code has been reduced to a bare minimum.

This patchset is admittedly rather big, but we wanted to show where the framework will lead to and what it enables. Suggestions as to how to better structure the patchset is appreciated.

There is still work to be done to more efficiently check for extra TCP options in performance-sensitive code paths. A rate-limited static key would nearly eliminate overhead if no extra TCP options are in use system-wide, or a flag in a likely-hot cache line could work well.

For now we opted for a simple if (unlikely(!hlist_empty(...)) check.

Feedback is very welcome!

Thanks,
Mat & Christoph

Changelog:
===
v1 -> v2:
* Some minor fixes thanks to the buildbot when certain configs are disabled (Patch 5 and 12)
* Add spdx-header in the new files (Patch 11)
* Added Ivan Delande to the CC-list as he did some TCP-MD5 changes in the past.

Christoph Paasch (13):
tcp: Write options after the header has been fully done
tcp: Pass sock and skb to tcp_options_write
tcp: Allow tcp_fast_parse_options to drop segments
tcp_smc: Make smc_parse_options return 1 on success
tcp_smc: Make SMC use TCP extra-option framework
tcp_md5: Don't pass along md5-key
tcp_md5: Detect key inside tcp_v4_send_ack instead of passing it as an
argument
tcp_md5: Detect key inside tcp_v6_send_response instead of passing it
as an argument
tcp_md5: Check for TCP_MD5 after TCP Timestamps in
tcp_established_options
tcp_md5: Move TCP-MD5 code out of TCP itself
tcp_md5: Use tcp_extra_options in output path
tcp_md5: Cleanup TCP-code
tcp_md5: Use TCP extra-options on the input path

Mat Martineau (1):
tcp: Register handlers for extra TCP options

 drivers/infiniband/hw/cxgb4/cm.c |    2 +-
 include/linux/inet_diag.h        |    1 +
 include/linux/tcp.h              |   43 +-
 include/linux/tcp_md5.h          |   40 ++
 include/net/inet_sock.h          |    3 +-
 include/net/tcp.h                |  213 +++---
 net/ipv4/Makefile                |    1 +
 net/ipv4/syncookies.c            |    6 +-
 net/ipv4/tcp.c                   |  391 ++++++++---
 net/ipv4/tcp_diag.c              |   81 +--
 net/ipv4/tcp_input.c             |  137 ++--
 net/ipv4/tcp_ipv4.c              |  556 ++--------------
 net/ipv4/tcp_md5.c               | 1359 ++++++++++++++++++++++++++++++++++++++
 net/ipv4/tcp_minisocks.c         |   75 +--
 net/ipv4/tcp_output.c            |  182 +----
 net/ipv6/syncookies.c            |    6 +-
 net/ipv6/tcp_ipv6.c              |  390 ++---------
 net/smc/af_smc.c                 |  190 +++++-
 18 files changed, 2228 insertions(+), 1448 deletions(-)
 create mode 100644 include/linux/tcp_md5.h
 create mode 100644 net/ipv4/tcp_md5.c
Signature · 1 line
2.16.1