Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1670753pxb; Thu, 16 Sep 2021 12:32:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziLwSjeWFRPjQCKHOTokVHFlNEHqbK9gEV8UJTXZuhuWHaTJB52VQSEvR/u9MOY8tJWerU X-Received: by 2002:aa7:d0c9:: with SMTP id u9mr8146163edo.167.1631820760777; Thu, 16 Sep 2021 12:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631820760; cv=none; d=google.com; s=arc-20160816; b=KTPJDcXFX/cEuZeOf3xX5zbtDzZ6j+g4A3KcvFOM+eANQJkK4dmU7ZdyaKhzQb53RB qAqE5NEvYZYpmwKh/mAA7PEkFW5zkFwyN+ZHoKPyeLtUE9WRQ1yQC3vBX0JGOTGChBY1 J7ySzvKkZzWQ9D1+PWJsscXQY2k42MRUTTvCK4O/ESUSJRqAvZnAqbiqVKPvec971YU2 opZmInOvxAQGaELhbK3C7ENvYal82g9aOkV3ZXoWsCn11eKlGYmQC9MVNcOrLUIdKVHO 8i4t9Bwyo3Epu4Hws+i3yolFlqeV/QarLBK41fpTCm65GNIthBnKnt3nQ1Zys/pho9VR ZRfw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i8niZqJw7raig9Q/hCaw39lsBErYnCTw6FmNcrJXW/o=; b=lWQuNtzo7Tq8EaboP+b6JhtJPaAPSBOucaNOrzVUbJDNEt9W3xKaT2Th+FL2KTdrrD YstTJOXYg9n3b8zFyV5sKL8SRGkmgD+tGVLav+Olb7iuepPOPXU4vCvYxzl/UUKWjny+ DtXhfpsemY90IVMvFbVstrPHkNWLU2zODLJplDHG30sebHImgvk0XPaylkgakXUAaRMo zuUnW7RFsVQGGHDT5VP4FLGse1wTAkESpDX414+ODTFzRyR2H+TxTaQd8Q4z8gYWel9G Qyey3WQmbiCDbhy6xI2hWkmFuv8kiLJRUbqbs4P+ZAxvYAD9KA0UvDVpwefLQSBHR4Od uzNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DO+bWwKc; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx16si4596345ejc.33.2021.09.16.12.32.16; Thu, 16 Sep 2021 12:32:40 -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=@linuxfoundation.org header.s=korg header.b=DO+bWwKc; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234443AbhIPQNS (ORCPT + 99 others); Thu, 16 Sep 2021 12:13:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:48354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234885AbhIPQIH (ORCPT ); Thu, 16 Sep 2021 12:08:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 62B4B6126A; Thu, 16 Sep 2021 16:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808406; bh=TCbqOC2lMijmDTVUlPZ/0ufFEh+w9K8qNu7szvP34sU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DO+bWwKcuZ59/ovisIHysARscl7LCu1B8TSajqTyPwAX63MluYX2ZC1JL9DDC0y7K KfIq98b3QSbkOCn1ZUETVyXKRni+I4tSQ+Dpq6I3knAYuoNaYwsX7QcoI0NWITLbvL Ul3iW6aGgnFi+fD5+DA4uiHqH3Z7A2NaklD49iIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Trond Myklebust , Sasha Levin Subject: [PATCH 5.10 080/306] SUNRPC query transports source port Date: Thu, 16 Sep 2021 17:57:05 +0200 Message-Id: <20210916155756.781145663@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Olga Kornievskaia [ Upstream commit a8482488a7d6d320f63a9ee1912dbb5ae5b80a61 ] Provide ability to query transport's source port. Signed-off-by: Olga Kornievskaia Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- include/linux/sunrpc/xprtsock.h | 1 + net/sunrpc/xprtsock.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h index 3c1423ee74b4..8c2a712cb242 100644 --- a/include/linux/sunrpc/xprtsock.h +++ b/include/linux/sunrpc/xprtsock.h @@ -10,6 +10,7 @@ int init_socket_xprt(void); void cleanup_socket_xprt(void); +unsigned short get_srcport(struct rpc_xprt *); #define RPC_MIN_RESVPORT (1U) #define RPC_MAX_RESVPORT (65535U) diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 9c0f71e82d97..7d7c08af54de 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -1639,6 +1639,13 @@ static int xs_get_srcport(struct sock_xprt *transport) return port; } +unsigned short get_srcport(struct rpc_xprt *xprt) +{ + struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt); + return sock->srcport; +} +EXPORT_SYMBOL(get_srcport); + static unsigned short xs_next_srcport(struct sock_xprt *transport, unsigned short port) { if (transport->srcport != 0) -- 2.30.2