Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2248407pxj; Sun, 9 May 2021 20:47:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT+BeQDjxbOolNmqN8Mmn99CVFKc8K3fglV80cirQPUkP356bpeHvzmFBG3qso2Dh+u2AB X-Received: by 2002:a17:906:abcc:: with SMTP id kq12mr23798082ejb.97.1620618428780; Sun, 09 May 2021 20:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620618428; cv=none; d=google.com; s=arc-20160816; b=WsLngzPbj3dgD6iNgnAl3v5xtIR+Ix7YkvTDCE2/DKQaySxpmpGVlRUtvlFZcr4sbY J9YGmR1hOtgUeKlADo3lRJO46N3MPo5JJL7JscrMZ1z+lWO/YA7LV3l9I4p0P+Z/0/N0 OJNiedUfHZa2WQGRppGKCIJuzQWIclu1ndWdnFVik/vPiYGmZAahMoP7BnTpLOIC/9S8 7xAoT69zVrGYxLkPkK/9OEakOVkHbhpQud4WueGdC9G6RMGXYGhwoZ9tTZweBXwLKG3p RvJtKqxTxDhwEWRG/8A9ccCkso03HyoVPQBKuc97lXb4Yr4SIK66aTIVby9FhqKuEt3I +wGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oOoI4UGGsXdLUQaM8cAPzanm+pnlwvsAMcQHQ9JQZ5g=; b=F3YDauZ65jo3lBlndBqboYZGu1i9rmnQfTldQfBq3hacPnDd8+0YCwO/W9urOuAdUA r6LxkygQT/E00Tl+bwOyU3+H4SZ9BDltSa2xTFeItikbKtCSvlxqsbDrmJknUYuo/NQP LhL1xSKC6wFhBqPhWf8uk6y5TtemiYQpM++q7P40lsDhZletJ6+EQm/tSKg1Xs2pqEqG ZH+qYhPYzKRvnYqQZhZuk+JgPHZ7LFm8U5poXFpmnwpAzXNj/MHOTwkhEKX+/JuMjlf+ rNGd0K68eP8wFpd3l6lGCu2Ge6zKivCJNgO6FYj95a95xDjfLWFy1H7uUtWYPHoQI+DQ lyAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.co.jp header.s=amazon201209 header.b=Ni9CoIF7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t2si12155590edd.569.2021.05.09.20.46.45; Sun, 09 May 2021 20:47:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.co.jp header.s=amazon201209 header.b=Ni9CoIF7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230198AbhEJDq1 (ORCPT + 99 others); Sun, 9 May 2021 23:46:27 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:51404 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbhEJDq0 (ORCPT ); Sun, 9 May 2021 23:46:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.co.jp; i=@amazon.co.jp; q=dns/txt; s=amazon201209; t=1620618324; x=1652154324; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oOoI4UGGsXdLUQaM8cAPzanm+pnlwvsAMcQHQ9JQZ5g=; b=Ni9CoIF7MjEhqBzq5SzSdSDW/ZjdRgVmFvfExj2Ed6I0Wz2Ha/T6Ec1n F79srdpbFWHMuq49Ur1B+uxlB9Koq2kgSry/rMXjbIJhQeOTnRfR+RIT2 2iQWSWDptBAXQ1Yn1yIr9DyEgqyVLPeciJ7rmqbx9I1UshnShTvl0AU1R Q=; X-IronPort-AV: E=Sophos;i="5.82,286,1613433600"; d="scan'208";a="108225759" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP; 10 May 2021 03:45:23 +0000 Received: from EX13MTAUWB001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id 94D64A204C; Mon, 10 May 2021 03:45:19 +0000 (UTC) Received: from EX13D04ANC001.ant.amazon.com (10.43.157.89) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 03:45:18 +0000 Received: from 88665a182662.ant.amazon.com (10.43.160.17) by EX13D04ANC001.ant.amazon.com (10.43.157.89) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 03:45:13 +0000 From: Kuniyuki Iwashima To: "David S . Miller" , Jakub Kicinski , Eric Dumazet , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau CC: Benjamin Herrenschmidt , Kuniyuki Iwashima , Kuniyuki Iwashima , , , Subject: [PATCH v5 bpf-next 01/11] net: Introduce net.ipv4.tcp_migrate_req. Date: Mon, 10 May 2021 12:44:23 +0900 Message-ID: <20210510034433.52818-2-kuniyu@amazon.co.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210510034433.52818-1-kuniyu@amazon.co.jp> References: <20210510034433.52818-1-kuniyu@amazon.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.43.160.17] X-ClientProxiedBy: EX13D18UWC001.ant.amazon.com (10.43.162.105) To EX13D04ANC001.ant.amazon.com (10.43.157.89) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit adds a new sysctl option: net.ipv4.tcp_migrate_req. If this option is enabled or eBPF program is attached, we will be able to migrate child sockets from a listener to another in the same reuseport group after close() or shutdown() syscalls. Signed-off-by: Kuniyuki Iwashima Reviewed-by: Benjamin Herrenschmidt --- Documentation/networking/ip-sysctl.rst | 20 ++++++++++++++++++++ include/net/netns/ipv4.h | 1 + net/ipv4/sysctl_net_ipv4.c | 9 +++++++++ 3 files changed, 30 insertions(+) diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst index c2ecc9894fd0..8e92f9b28aad 100644 --- a/Documentation/networking/ip-sysctl.rst +++ b/Documentation/networking/ip-sysctl.rst @@ -732,6 +732,26 @@ tcp_syncookies - INTEGER network connections you can set this knob to 2 to enable unconditionally generation of syncookies. +tcp_migrate_req - INTEGER + The incoming connection is tied to a specific listening socket when + the initial SYN packet is received during the three-way handshake. + When a listener is closed, in-flight request sockets during the + handshake and established sockets in the accept queue are aborted. + + If the listener has SO_REUSEPORT enabled, other listeners on the + same port should have been able to accept such connections. This + option makes it possible to migrate such child sockets to another + listener after close() or shutdown(). + + Default: 0 + + Note that the source and destination listeners MUST have the same + settings at the socket API level. If different applications listen + on the same port, disable this option or attach the + BPF_SK_REUSEPORT_SELECT_OR_MIGRATE type of eBPF program to select + the correct socket by bpf_sk_select_reuseport() or to cancel + migration by returning SK_DROP. + tcp_fastopen - INTEGER Enable TCP Fast Open (RFC7413) to send and accept data in the opening SYN packet. diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index f6af8d96d3c6..fd63c91addcc 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -126,6 +126,7 @@ struct netns_ipv4 { u8 sysctl_tcp_syn_retries; u8 sysctl_tcp_synack_retries; u8 sysctl_tcp_syncookies; + u8 sysctl_tcp_migrate_req; int sysctl_tcp_reordering; u8 sysctl_tcp_retries1; u8 sysctl_tcp_retries2; diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index a62934b9f15a..7bb013fcbf5f 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -940,6 +940,15 @@ static struct ctl_table ipv4_net_table[] = { .proc_handler = proc_dou8vec_minmax, }, #endif + { + .procname = "tcp_migrate_req", + .data = &init_net.ipv4.sysctl_tcp_migrate_req, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE + }, { .procname = "tcp_reordering", .data = &init_net.ipv4.sysctl_tcp_reordering, -- 2.30.2