From patchwork Mon Feb 24 14:59:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Davide Caratti X-Patchwork-Id: 1243181 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WA1yHQPk; dkim-atps=neutral Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48R4x96Zr8z9sNg for ; Tue, 25 Feb 2020 02:00:12 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6DF0F10FC3598; Mon, 24 Feb 2020 07:01:01 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=205.139.110.61; helo=us-smtp-delivery-1.mimecast.com; envelope-from=dcaratti@redhat.com; receiver= Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1D1B210FC3596 for ; Mon, 24 Feb 2020 07:00:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582556405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=y4VKdp7ldXcspEwpeEYmbzoFeviMjKeunhPYg/YJncw=; b=WA1yHQPkDBw1SaszePZwLyH85iZVpxCqJhfqOVwrzmqv6McyqLSl/jY0qwVYZkbkdJN021 8sAjnXxjAGBXwQnCG+h2oz8BJyy5eidrzFSP6spKWEbrOqsMwInnLOBZDWwSxRcJ6gPyr4 w26zLJlVOPEosdZwAqRA4E9DltSf+A0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-336-z-soalG6MECUUVd2THUOXA-1; Mon, 24 Feb 2020 10:00:01 -0500 X-MC-Unique: z-soalG6MECUUVd2THUOXA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 57AD0477; Mon, 24 Feb 2020 15:00:00 +0000 (UTC) Received: from new-host-5.redhat.com (ovpn-205-102.brq.redhat.com [10.40.205.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 302DD1001B2C; Mon, 24 Feb 2020 14:59:58 +0000 (UTC) From: Davide Caratti To: mptcp@lists.01.org Cc: Matthieu Baerts , Paolo Abeni Date: Mon, 24 Feb 2020 15:59:46 +0100 Message-Id: <3e6ba8371d82801358113ba14218b2b889f4098a.1582556386.git.dcaratti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: KOHKZXZZ3VEPT3VQENT7VA4DQXVBA6V6 X-Message-ID-Hash: KOHKZXZZ3VEPT3VQENT7VA4DQXVBA6V6 X-MailFrom: dcaratti@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH] net: mptcp: rename MPTCP_SUBFLOW_* into MPTCP_SUBFLOW_ATTR_* in diag uAPI List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Squash-to: "mptcp: allow dumping subflow context to userspace" otherwise MPTCP_SUBFLOW_MAX might recall the maximum possible number of subflows in a MPTCP connection, which is not controlled by uAPI at all. Signed-off-by: Davide Caratti --- include/uapi/linux/mptcp.h | 28 ++++++++++++------------ net/mptcp/diag.c | 45 ++++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h index 3912a9808fa2..d087048fb4a2 100644 --- a/include/uapi/linux/mptcp.h +++ b/include/uapi/linux/mptcp.h @@ -15,20 +15,20 @@ #define MPTCP_SUBFLOW_FLAG_MAPVALID BIT(8) enum { - MPTCP_SUBFLOW_UNSPEC, - MPTCP_SUBFLOW_TOKEN_REM, - MPTCP_SUBFLOW_TOKEN_LOC, - MPTCP_SUBFLOW_RELWRITE_SEQ, - MPTCP_SUBFLOW_MAP_SEQ, - MPTCP_SUBFLOW_MAP_SFSEQ, - MPTCP_SUBFLOW_SSN_OFFSET, - MPTCP_SUBFLOW_MAP_DATALEN, - MPTCP_SUBFLOW_FLAGS, - MPTCP_SUBFLOW_ID_REM, - MPTCP_SUBFLOW_ID_LOC, - MPTCP_SUBFLOW_PAD, - __MPTCP_SUBFLOW_MAX + MPTCP_SUBFLOW_ATTR_UNSPEC, + MPTCP_SUBFLOW_ATTR_TOKEN_REM, + MPTCP_SUBFLOW_ATTR_TOKEN_LOC, + MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ, + MPTCP_SUBFLOW_ATTR_MAP_SEQ, + MPTCP_SUBFLOW_ATTR_MAP_SFSEQ, + MPTCP_SUBFLOW_ATTR_SSN_OFFSET, + MPTCP_SUBFLOW_ATTR_MAP_DATALEN, + MPTCP_SUBFLOW_ATTR_FLAGS, + MPTCP_SUBFLOW_ATTR_ID_REM, + MPTCP_SUBFLOW_ATTR_ID_LOC, + MPTCP_SUBFLOW_ATTR_PAD, + __MPTCP_SUBFLOW_ATTR_MAX }; -#define MPTCP_SUBFLOW_MAX (__MPTCP_SUBFLOW_MAX - 1) +#define MPTCP_SUBFLOW_ATTR_MAX (__MPTCP_SUBFLOW_ATTR_MAX - 1) #endif /* _UAPI_MPTCP_H */ diff --git a/net/mptcp/diag.c b/net/mptcp/diag.c index 830a2adfc0fa..4b6d9f7e418f 100644 --- a/net/mptcp/diag.c +++ b/net/mptcp/diag.c @@ -50,17 +50,20 @@ static int subflow_get_info(const struct sock *sk, struct sk_buff *skb) if (sf->map_valid) flags |= MPTCP_SUBFLOW_FLAG_MAPVALID; - if (nla_put_u32(skb, MPTCP_SUBFLOW_TOKEN_REM, sf->remote_token) || - nla_put_u32(skb, MPTCP_SUBFLOW_TOKEN_LOC, sf->token) || - nla_put_u32(skb, MPTCP_SUBFLOW_RELWRITE_SEQ, sf->rel_write_seq) || - nla_put_u64_64bit(skb, MPTCP_SUBFLOW_MAP_SEQ, sf->map_seq, - MPTCP_SUBFLOW_PAD) || - nla_put_u32(skb, MPTCP_SUBFLOW_MAP_SFSEQ, sf->map_subflow_seq) || - nla_put_u32(skb, MPTCP_SUBFLOW_SSN_OFFSET, sf->ssn_offset) || - nla_put_u16(skb, MPTCP_SUBFLOW_MAP_DATALEN, sf->map_data_len) || - nla_put_u32(skb, MPTCP_SUBFLOW_FLAGS, flags) || - nla_put_u8(skb, MPTCP_SUBFLOW_ID_REM, sf->remote_id) || - nla_put_u8(skb, MPTCP_SUBFLOW_ID_LOC, sf->local_id)) { + if (nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_TOKEN_REM, sf->remote_token) || + nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_TOKEN_LOC, sf->token) || + nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ, + sf->rel_write_seq) || + nla_put_u64_64bit(skb, MPTCP_SUBFLOW_ATTR_MAP_SEQ, sf->map_seq, + MPTCP_SUBFLOW_ATTR_PAD) || + nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_MAP_SFSEQ, + sf->map_subflow_seq) || + nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_SSN_OFFSET, sf->ssn_offset) || + nla_put_u16(skb, MPTCP_SUBFLOW_ATTR_MAP_DATALEN, + sf->map_data_len) || + nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_FLAGS, flags) || + nla_put_u8(skb, MPTCP_SUBFLOW_ATTR_ID_REM, sf->remote_id) || + nla_put_u8(skb, MPTCP_SUBFLOW_ATTR_ID_LOC, sf->local_id)) { err = -EMSGSIZE; goto nla_failure; } @@ -80,16 +83,16 @@ static size_t subflow_get_info_size(const struct sock *sk) size_t size = 0; size += nla_total_size(0) + /* INET_ULP_INFO_MPTCP */ - nla_total_size(4) + /* MPTCP_SUBFLOW_TOKEN_REM */ - nla_total_size(4) + /* MPTCP_SUBFLOW_TOKEN_LOC */ - nla_total_size(4) + /* MPTCP_SUBFLOW_RELWRITE_SEQ */ - nla_total_size_64bit(8) + /* MPTCP_SUBFLOW_MAP_SEQ */ - nla_total_size(4) + /* MPTCP_SUBFLOW_MAP_SFSEQ */ - nla_total_size(2) + /* MPTCP_SUBFLOW_SSN_OFFSET */ - nla_total_size(2) + /* MPTCP_SUBFLOW_MAP_DATALEN */ - nla_total_size(4) + /* MPTCP_SUBFLOW_FLAGS */ - nla_total_size(1) + /* MPTCP_SUBFLOW_ID_REM */ - nla_total_size(1) + /* MPTCP_SUBFLOW_ID_LOC */ + nla_total_size(4) + /* MPTCP_SUBFLOW_ATTR_TOKEN_REM */ + nla_total_size(4) + /* MPTCP_SUBFLOW_ATTR_TOKEN_LOC */ + nla_total_size(4) + /* MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ */ + nla_total_size_64bit(8) + /* MPTCP_SUBFLOW_ATTR_MAP_SEQ */ + nla_total_size(4) + /* MPTCP_SUBFLOW_ATTR_MAP_SFSEQ */ + nla_total_size(2) + /* MPTCP_SUBFLOW_ATTR_SSN_OFFSET */ + nla_total_size(2) + /* MPTCP_SUBFLOW_ATTR_MAP_DATALEN */ + nla_total_size(4) + /* MPTCP_SUBFLOW_ATTR_FLAGS */ + nla_total_size(1) + /* MPTCP_SUBFLOW_ATTR_ID_REM */ + nla_total_size(1) + /* MPTCP_SUBFLOW_ATTR_ID_LOC */ 0; return size; }