Skip to content

net: preserve sock reference when scrubbing the skb.

Flavio Leitner netdev netfilter-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 10 repliesIn review
  2. v11 patch 24 repliesSuperseded

ChangeLog from the cover letter

- split into two (Eric)
- addressed Paolo's offline feedback to swap the checks in xt_socket.c to preserve original behavior.
- improved ip-sysctl.txt (reported by Cong)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2netfilter: check if the socket netns is correct.include/net/netfilter/nf_log.h net/ipv4/netfilter/nf_log_ipv4.c net/ipv6/netfilter/nf_log_ipv6.c +9 more+44 -211 reply
2/2skbuff: preserve sock reference when scrubbing the skb.Documentation/networking/ip-sysctl.txt net/core/skbuff.c+5 -61 reply

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchFlorian Westphal
1/2A-b
2/2

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

Read the v2 thread

Cover letter [PATCH v2 net-next 0/2] net: preserve sock reference when scrubbing the skb.

The sock reference is lost when scrubbing the packet and that breaks TSQ (TCP Small Queues) and XPS (Transmit Packet Steering) causing performance impacts of about 50% in a single TCP stream when crossing network namespaces.

XPS breaks because the queue mapping stored in the socket is not available, so another random queue might be selected when the stack needs to transmit something like a TCP ACK, or TCP Retransmissions. That causes packet re-ordering and/or performance issues.

TSQ breaks because it orphans the packet while it is still in the host, so packets are queued contributing to the buffer bloat problem.

Preserving the sock reference fixes both issues. The socket is orphaned anyways in the receiving path before any relevant action, but the transmit side needs some extra checking included in the first patch.

The first patch will update netfilter to check if the socket netns is local before use it.

The second patch removes the skb_orphan() from the skb_scrub_packet() and improve the documentation.

ChangeLog:
- split into two (Eric)
- addressed Paolo's offline feedback to swap the checks in xt_socket.c to preserve original behavior.
- improved ip-sysctl.txt (reported by Cong)

Flavio Leitner (2):
netfilter: check if the socket netns is correct.
skbuff: preserve sock reference when scrubbing the skb.

 Documentation/networking/ip-sysctl.txt | 10 +++++-----
 include/net/netfilter/nf_log.h         |  3 ++-
 net/core/skbuff.c                      |  1 -
 net/ipv4/netfilter/nf_log_ipv4.c       |  8 ++++----
 net/ipv6/netfilter/nf_log_ipv6.c       |  8 ++++----
 net/netfilter/nf_conntrack_broadcast.c |  2 +-
 net/netfilter/nf_log_common.c          |  5 +++--
 net/netfilter/nf_nat_core.c            |  6 +++++-
 net/netfilter/nft_meta.c               |  9 ++++++---
 net/netfilter/nft_socket.c             |  5 ++++-
 net/netfilter/xt_cgroup.c              |  6 ++++--
 net/netfilter/xt_owner.c               |  2 +-
 net/netfilter/xt_recent.c              |  3 ++-
 net/netfilter/xt_socket.c              |  8 ++++++++
 14 files changed, 49 insertions(+), 27 deletions(-)
Signature · 1 line
2.14.3