From patchwork Wed Aug 21 21:46:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sabrina Dubroca X-Patchwork-Id: 1151176 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=queasysnail.net Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46DLnk09Gxz9s4Y for ; Thu, 22 Aug 2019 07:46:02 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729190AbfHUVqA (ORCPT ); Wed, 21 Aug 2019 17:46:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33068 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727874AbfHUVqA (ORCPT ); Wed, 21 Aug 2019 17:46:00 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7BFC130821C2; Wed, 21 Aug 2019 21:45:59 +0000 (UTC) Received: from hog.localdomain, (ovpn-204-30.brq.redhat.com [10.40.204.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CC0E194B9; Wed, 21 Aug 2019 21:45:57 +0000 (UTC) From: Sabrina Dubroca To: netdev@vger.kernel.org Cc: Herbert Xu , Steffen Klassert , Sabrina Dubroca Subject: [PATCH ipsec-next 0/7] ipsec: add TCP encapsulation support (RFC 8229) Date: Wed, 21 Aug 2019 23:46:18 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 21 Aug 2019 21:45:59 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patchset introduces support for TCP encapsulation of IKE and ESP messages, as defined by RFC 8229 [0]. It is an evolution of what Herbert Xu proposed in January 2018 [1] that addresses the main criticism against it, by not interfering with the TCP implementation at all. The networking stack now has infrastructure for this: TCP ULPs and Stream Parsers. The first patches are preparation and refactoring, and the final patch adds the feature. The main omission in this submission is IPv6 support. ESP encapsulation over UDP with IPv6 is currently not supported in the kernel either, as UDP encapsulation is aimed at NAT traversal, and NAT is not frequently used with IPv6. Some of the code is taken directly, or slightly modified, from Herbert Xu's original submission [1]. The ULP and strparser pieces are new. This work was presented and discussed at the IPsec workshop and netdev 0x13 conference [2] in Prague, last March. An equivalent of patch #1 (skbuff: Avoid sleeping in skb_send_sock_locked) is already present in other trees (but not ipsec-next) as commit bd95e678e0f6 ("bpf: sockmap, fix use after free from sleep in psock backlog workqueue"), I'm only including it here so that this patchset works correctly on top of ipsec-next/master. No changes in the patchset since the RFC. [0] https://tools.ietf.org/html/rfc8229 [1] https://patchwork.ozlabs.org/patch/859107/ [2] https://netdevconf.org/0x13/session.html?talk-ipsec-encap Herbert Xu (1): skbuff: Avoid sleeping in skb_send_sock_locked Sabrina Dubroca (6): net: add queue argument to __skb_wait_for_more_packets and __skb_{,try_}recv_datagram xfrm: introduce xfrm_trans_queue_net xfrm: add route lookup to xfrm4_rcv_encap esp4: prepare esp_input_done2 for non-UDP encapsulation esp4: split esp_output_udp_encap and introduce esp_output_encap xfrm: add espintcp (RFC 8229) include/linux/skbuff.h | 11 +- include/net/espintcp.h | 38 +++ include/net/xfrm.h | 4 + include/uapi/linux/udp.h | 1 + net/core/datagram.c | 26 +- net/core/skbuff.c | 1 + net/ipv4/esp4.c | 262 ++++++++++++++++++-- net/ipv4/udp.c | 3 +- net/ipv4/xfrm4_protocol.c | 9 + net/unix/af_unix.c | 7 +- net/xfrm/Kconfig | 9 + net/xfrm/Makefile | 1 + net/xfrm/espintcp.c | 505 ++++++++++++++++++++++++++++++++++++++ net/xfrm/xfrm_input.c | 21 +- net/xfrm/xfrm_policy.c | 7 + net/xfrm/xfrm_state.c | 3 + 16 files changed, 862 insertions(+), 46 deletions(-) create mode 100644 include/net/espintcp.h create mode 100644 net/xfrm/espintcp.c