From patchwork Tue Apr 9 19:09:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Herbert X-Patchwork-Id: 1082649 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=herbertland.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=herbertland-com.20150623.gappssmtp.com header.i=@herbertland-com.20150623.gappssmtp.com header.b="kCmJ4nQy"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44dxgq4bjTz9sSQ for ; Wed, 10 Apr 2019 05:10:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726774AbfDITKL (ORCPT ); Tue, 9 Apr 2019 15:10:11 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:44646 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbfDITKL (ORCPT ); Tue, 9 Apr 2019 15:10:11 -0400 Received: by mail-pf1-f194.google.com with SMTP id y13so10274272pfm.11 for ; Tue, 09 Apr 2019 12:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=herbertland-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=5xZNsko4Yx0SEXSZLPUheys8CiT1L7EQP4FvEWdIUa4=; b=kCmJ4nQyjwiHlZamNVIj3H5y6BIV0KMNSvmOV7FwtrCLd3OtNoji7P3phzwFvNomQd 5Fj/jJ2pjbGi5VA4N9fZOhW8alssXGb/J5UVkZpNw7xa6v0NKqx3qKkBnqDW+gSrZ7BT 7L1AMX18iR1EzFKQa+mAzr5J5t+QI79HB+CsY2eNOk1+FPpggC9mZMNBJPmP6/hcROk9 m6Ir5KjREL3hhTpPlwqiLXxttLy2VoEhbhKwvh0dssaYnqj6ydeUcf8/9eVgHUxQSPSB SQPQerC41o/KgsXtJe6bbX3bQ9a82fBWr3IHEYira4oA3coOxzF9y8+ZNXjEv7BoPOXI +GGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5xZNsko4Yx0SEXSZLPUheys8CiT1L7EQP4FvEWdIUa4=; b=OLdb/u0pE87bWMZvsFOiuXgPIJzXoCodvelqXitS1orqhm+qwQWSOn9W94Qq5h4D9W 2kog0FV1kx17QLLOUD8baWtOuurO9fGUkpDLAfqtfpc2zvZMRHW43UsgMPGaYSfNgiR/ jqh6Bo8WLCpqLvVht9LQT8qVPpRI/s/CHMRknrOARDUGoa3DchTY8SuJU5qwUw2CXisc gQMtaarrTZLj/fPZmSBSa6yp19DEvEKyGJpTToM9qQ4RCYIuVw+bvdXmXGa6kSdW6Dn4 E4q8qLZIjZWCcIGVaQuyl/wqUP52SQx1VmJ2VKh83bXm1wqi0qtRRna1rFIGDfqikdSa 9utg== X-Gm-Message-State: APjAAAVw2ZYkA3t5cSkIxR5q33Zr0iYGj537kpSTgSomyRMAFNXicYdN 4Gwa1w9+cXF7RGz5QxiJyd2/im5Oqow= X-Google-Smtp-Source: APXvYqyamntmRHVN+dB6+dKlVT28SZY0JUc1btuV/sT8Wt7LwSpd1+irRfZi2cgzYdEtFm3rYd2Eqg== X-Received: by 2002:a63:7150:: with SMTP id b16mr34893181pgn.83.1554837009709; Tue, 09 Apr 2019 12:10:09 -0700 (PDT) Received: from localhost.localdomain (c-73-223-249-119.hsd1.ca.comcast.net. [73.223.249.119]) by smtp.gmail.com with ESMTPSA id k1sm28386188pfc.83.2019.04.09.12.10.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Apr 2019 12:10:08 -0700 (PDT) From: Tom Herbert X-Google-Original-From: Tom Herbert To: davem@davemloft.net, netdev@vger.kernel.org Cc: Tom Herbert Subject: [PATCH v2 net-next 0/6] exthdrs: Make ext. headers & options useful - Part I Date: Tue, 9 Apr 2019 12:09:47 -0700 Message-Id: <1554836993-5056-1-git-send-email-tom@quantonium.net> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Extension headers are the mechanism of extensibility for the IPv6 protocol, however to date they have only seen limited deployment. The reasons for that are because intermediate devices don't handle them well, and there haven't really be any useful extension headers defined. In particular, Destination and Hop-by-Hop options have not been deployed to any extent. The landscape may be changing as there are now a number of serious efforts to define and deploy extension headers. In particular, a number of uses for Hop-by-Hop Options are currently being proposed, Some of these are from router vendors so there is hope that they might start start to fix their brokenness. These proposals include IOAM, Path MTU, Firewall and Service Tickets, SRv6, CRH, etc. Assuming that IPv6 extension headers gain traction, that leaves a noticeable gap in IPv4 support. IPv4 options have long been considered a non-starter for deployment. An alternative being proposed is to enable use of IPv6 options with IPv4 (draft-herbert-ipv4-eh-00). This series of patch sets endeavours to make extension headers and related options useful and easy to use. The following items will be addressed: - Reorganize extension header files - Allow registration of TLV handlers - Elaborate on the TLV tables to include more characteristics - Add a netlink interface to set TLV parameters (such as alignment requirements, authorization to send, etc.) - Enhance validation of TLVs being sent. Validation is strict (unless overridden by admin) following that sending clause of the robustness principle - Allow non-privileged users to set Hop-by-Hop and Destination Options if authorized by the admin - Add an API that allows individual Hop-by-Hop and Destination Options to be set or removed for a connected socket. The backend end enforces permissions on what TLVs may be set and merges set TLVs per following the rules in the TLV parameter table (for instance, TLV parameters include a preferred sending order that merging adheres to) - Support for some of the aforementioned options - Enable IPv4 extension headers ------ In this series: - Create exhdrs_options.c. Move options specific processing to this file from exthdrs.c (for RA, Jumbo, Calipso, and HAO) - Allow modules to register TLV handlers for Destination and HBH options. - Add parameters block to TLV type entries that describe characteristics related to the TLV. For the most part, these encode rules about sending each TLV (TLV alignment requirements for instance). - Add a netlink interface to manage parameters in the TLV table. - Add validation of HBH and Destination Options that are set on a socket or in ancillary data in sendmsg. The validation applies the rules that are encoded in the TLV parameters. - TLV parameters includes permissions that may allow non-privileged users to set specific TLVs on a socket HBH options or Destination options. Strong validation can be enabled for this to constrain what the non-privileged user is able to do. v2: - Don't rename extension header files with IPv6 specific code before code for IPv4 extension headers is present - Added patches for creating TLV parameters and validation Tested: Set Hop-by-Hop options on TCP/UDP socket and verified to be functional. Tom Herbert (6): exthdrs: Create exthdrs_options.c exthdrs: Move generic EH functions to exthdrs_core.c exthdrs: Registration of TLV handlers and parameters exthdrs: Add TX parameters ip6tlvs: Add netlink interface ip6tlvs: Validation of TX Destination and Hop-by-Hop options include/net/ipv6.h | 109 +++++ include/uapi/linux/in6.h | 49 ++ net/ipv6/Makefile | 2 +- net/ipv6/datagram.c | 30 +- net/ipv6/exthdrs.c | 388 +-------------- net/ipv6/exthdrs_core.c | 1162 ++++++++++++++++++++++++++++++++++++++++++++ net/ipv6/exthdrs_options.c | 271 +++++++++++ net/ipv6/ipv6_sockglue.c | 35 +- 8 files changed, 1643 insertions(+), 403 deletions(-) create mode 100644 net/ipv6/exthdrs_options.c