From patchwork Fri Dec 14 22:40:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Paasch X-Patchwork-Id: 1013750 X-Patchwork-Delegate: davem@davemloft.net 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=fail (p=quarantine dis=none) header.from=apple.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=apple.com header.i=@apple.com header.b="BKfhkGI6"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43Glr75wtwz9s47 for ; Sat, 15 Dec 2018 09:40:39 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730153AbeLNWkh (ORCPT ); Fri, 14 Dec 2018 17:40:37 -0500 Received: from ma1-aaemail-dr-lapp03.apple.com ([17.171.2.72]:48240 "EHLO ma1-aaemail-dr-lapp03.apple.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729691AbeLNWkg (ORCPT ); Fri, 14 Dec 2018 17:40:36 -0500 Received: from pps.filterd (ma1-aaemail-dr-lapp03.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp03.apple.com (8.16.0.27/8.16.0.27) with SMTP id wBEMVXhi025894; Fri, 14 Dec 2018 14:40:33 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=content-transfer-encoding : sender : from : to : cc : subject : date : message-id : in-reply-to : references; s=20180706; bh=YuXYXyVORq8JgmMgMif3YfV8NEtXdedqqm8kP+BtBLU=; b=BKfhkGI6IO61Y0inEsFktlZLKG8KMsEpERndAxisVUdXedSAz6KXCcXIMckw1tUAChX4 jgB06Oz5U8a7m5wmOzRZ4Fx80TWuz9lVzhzl2frvcy/BYF3cTUp8pvzMEnK61HzZFbiK lSNYsMWMXW7N+dVu9t6Pg6lJT/v3zAZKj8YXodQT3j1SHRmsV6Vy2dq0Yb1+iVSv6w7J UdbOXz188C+lkzW4urC15zTgLYhJiZkgCJTx/YDRC9jinxOJbSfFVX8x9pz0NQgF37eq Y418jkbqIdMBLXrOW+VoXWDnsugBHN9S6cUcC9Md+t+m9iNxw6PEmB1S338DXj000oxa qQ== Received: from mr2-mtap-s03.rno.apple.com (mr2-mtap-s03.rno.apple.com [17.179.226.135]) by ma1-aaemail-dr-lapp03.apple.com with ESMTP id 2pa3b561p2-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Fri, 14 Dec 2018 14:40:33 -0800 Content-transfer-encoding: 7BIT Received: from nwk-mmpp-sz09.apple.com (nwk-mmpp-sz09.apple.com [17.128.115.80]) by mr2-mtap-s03.rno.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) with ESMTPS id <0PJR00MIZ0BLVJA0@mr2-mtap-s03.rno.apple.com>; Fri, 14 Dec 2018 14:40:33 -0800 (PST) Received: from process_viserion-daemon.nwk-mmpp-sz09.apple.com by nwk-mmpp-sz09.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) id <0PJQ00B00Z1EGU00@nwk-mmpp-sz09.apple.com>; Fri, 14 Dec 2018 14:40:33 -0800 (PST) X-Va-A: X-Va-T-CD: 4b1e0bf36502e052fc75ad21b706ed24 X-Va-E-CD: c15ada7c17434f8b105b520dc76a5ec3 X-Va-R-CD: d422ff2622491ec6eb50295d178babe5 X-Va-CD: 0 X-Va-ID: f0a51799-de43-4399-a0c0-6a2e7e9ed99a X-V-A: X-V-T-CD: 5c1d590bbb3e9640019563b4ec412a7e X-V-E-CD: c15ada7c17434f8b105b520dc76a5ec3 X-V-R-CD: d422ff2622491ec6eb50295d178babe5 X-V-CD: 0 X-V-ID: 696d1723-33a4-4a4f-bb2a-9060ea84e403 Received: from process_milters-daemon.nwk-mmpp-sz09.apple.com by nwk-mmpp-sz09.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) id <0PJR00F0009AI500@nwk-mmpp-sz09.apple.com>; Fri, 14 Dec 2018 14:40:31 -0800 (PST) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-14_13:,, signatures=0 Received: from localhost ([17.192.155.217]) by nwk-mmpp-sz09.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) with ESMTPSA id <0PJR00GB90BISV00@nwk-mmpp-sz09.apple.com>; Fri, 14 Dec 2018 14:40:31 -0800 (PST) From: Christoph Paasch To: netdev@vger.kernel.org Cc: Eric Dumazet , Yuchung Cheng , David Miller Subject: [PATCH net-next 4/5] tcp: Allow getsockopt of listener's keypool Date: Fri, 14 Dec 2018 14:40:06 -0800 Message-id: <20181214224007.54813-5-cpaasch@apple.com> X-Mailer: git-send-email 2.16.2 In-reply-to: <20181214224007.54813-1-cpaasch@apple.com> References: <20181214224007.54813-1-cpaasch@apple.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-14_13:, , signatures=0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Allow to get the full list of the listener's keypool through a getsockopt. Signed-off-by: Christoph Paasch --- net/ipv4/tcp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 27e2f6837062..cdb317392138 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3420,21 +3420,24 @@ static int do_tcp_getsockopt(struct sock *sk, int level, return 0; case TCP_FASTOPEN_KEY: { - __u8 key[TCP_FASTOPEN_KEY_LENGTH]; + __u8 key[TCP_FASTOPEN_KEY_LENGTH * TCP_FASTOPEN_CTXT_LEN]; struct tcp_fastopen_context *ctx; + unsigned int key_len = 0; if (get_user(len, optlen)) return -EFAULT; rcu_read_lock(); ctx = rcu_dereference(icsk->icsk_accept_queue.fastopenq.ctx); - if (ctx) - memcpy(key, ctx->key, sizeof(key)); - else - len = 0; + while (ctx) { + memcpy(&key[key_len], ctx->key, TCP_FASTOPEN_KEY_LENGTH); + + key_len += TCP_FASTOPEN_KEY_LENGTH; + ctx = rcu_dereference(ctx->next); + } rcu_read_unlock(); - len = min_t(unsigned int, len, sizeof(key)); + len = min_t(unsigned int, len, key_len); if (put_user(len, optlen)) return -EFAULT; if (copy_to_user(optval, key, len))