Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2679164pxj; Mon, 17 May 2021 07:21:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz66/qyLTYywLY1YFpPTh76rSzwpiwkHVYrcZH6I74TP6kvpJUv/Q2/ZRoyzriuzfj/H6YL X-Received: by 2002:a17:906:38c5:: with SMTP id r5mr172652ejd.230.1621261290676; Mon, 17 May 2021 07:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621261290; cv=none; d=google.com; s=arc-20160816; b=JOIRnWRB9+Vpv3ewWCqEuy9s5QXsJ+6olBJAsir+JGRo3bat29gBPYlbDhT0QJQ578 pGYdyyOfehuEIry/50B3w+N09cL3yFj7kF3GgZ0l1HoUPoT3uFBPHmJGc1AtfOzpdJqa EgH2XyAGFeTtaSX4iGEwAXYFCdKarYj4M+ZaA09cTMrsurK1WR1A25kAj7qTp4EaiIVi SrrMR1id9iHdGu1Ysh2EG9Xvfd1uSSZct+dliGcRWSxziyx7M/XuZchfPIFvBhH6ALPf 5f9U3ZIV8t0SSlmGhEWk16HjHI0mEeV7J5jOplKdP7D59BPWB7O5qcnAjJhmX/LOx8C7 azrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=s8Z+w1Y6Rf9gclo3jq11QDfu9zPhiWbiWM7O3Q/pH7g=; b=rijscIMC28LIktLBOMY6vHxvKCJOPq2Bb4x1HT8QbC3pUlrhX1HpBd49ns0u0IaPQy W6Ip8oIUIlkYsP5R6VZHq+hKJx0gxSRNSi1IiV3Q+hEBZbD/UZ9nSpHzI7taQUW1JsRG PhpZZSOY1nKlrzWcAKWOAZEn/4GhOEfAB8GdMVDpKB9eSL90dJFHTWWEAoyrmCb6xTbC a4Y1N1VIvJNdHJD7nM/TNYhjPDBtYBDcyxS8HLKL/cu+YqNRW+AqjowNQRNEA9hrN7fy AtLTeHp51FgwsfWLodtN7BS4Pfl9KlrFfA5//RC7xhJwfEI/qD80plXiEfL+iGqMQO2x upxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WXUny7D9; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp16si15868381ejc.478.2021.05.17.07.21.07; Mon, 17 May 2021 07:21:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@gmail.com header.s=20161025 header.b=WXUny7D9; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235482AbhEQNy7 (ORCPT + 99 others); Mon, 17 May 2021 09:54:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232924AbhEQNy7 (ORCPT ); Mon, 17 May 2021 09:54:59 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2650EC061756 for ; Mon, 17 May 2021 06:53:43 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id k14so5848571eji.2 for ; Mon, 17 May 2021 06:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s8Z+w1Y6Rf9gclo3jq11QDfu9zPhiWbiWM7O3Q/pH7g=; b=WXUny7D9XwCLWhtEMS5dhHdu+m7ukLt7WrXtkbbsmZQHzA4XPDt/wotC8XHmebQhwY HJqoDdnw37k5cWXc0+SBLu9FfKfEbHt05VAtRiTDzFUiMNrXpolJeHZJ7FDWRBac3Gjl 6q9qAnmS0z+crSU09CAY4ZAsPLR7YKRpgVLnrjJ3KlgWzTydplljo0Jp9g9i5vO+CtLS wjhDHhSNqklvUK0Zt3jq3M7cHGBl5ibLL9dneMvhKwGGHFje9lVUQUyuc5DR8Oji5oMq z0oB3Gsg/WcLSkjNAVHX2p4lpicKEj2SoLFHyafKPexm98wh4zbHiSIb6OdBUEdsF09n HHiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s8Z+w1Y6Rf9gclo3jq11QDfu9zPhiWbiWM7O3Q/pH7g=; b=oDsoJ03MmVubIqMfTMQ7KlTty+fsLp1ZZwxmONeHIqFLZFW9hAEC2EHxqIvZSaPG9o 6heDgsF1H+UHBD1H/J6j9TwL5GPNza1+uYZSvLfpMWijztp7EAx5X10mn5Yw8JZVd8Az UQbGj/AwHWcYhK2IzeoxQVS42MwwV1+m6i0LLt+Qi85wQSEPeTIvqHEERzbeGR4cNQO9 I55kylVTFOS8uckosu8zDgRgHyD/bd1rwJ8imGYxZaEMyy5tC6nPlL72ING1mx6v4iYS cLA+BYuEUpHS2YB84oiJ6z1pw2JXxOOOddCAGyDmsw154c3S6oP2VpXS91ksnLAfcEQI fAPQ== X-Gm-Message-State: AOAM531mcWZBbJiMBeFK63c6ddz3m6muQaGN1/qPR5PyCDKyzGzc5+u9 qCmmqP8vs338/kqxREMhOS98TjWsQrKV3mOSyiDz7jo8wzI= X-Received: by 2002:a17:906:584e:: with SMTP id h14mr27618ejs.432.1621259621792; Mon, 17 May 2021 06:53:41 -0700 (PDT) MIME-Version: 1.0 References: <20210514141323.67922-1-olga.kornievskaia@gmail.com> <20210514141323.67922-11-olga.kornievskaia@gmail.com> <20210515124232.y7xmofawebp7l5w6@gmail.com> In-Reply-To: <20210515124232.y7xmofawebp7l5w6@gmail.com> From: Olga Kornievskaia Date: Mon, 17 May 2021 09:53:30 -0400 Message-ID: Subject: Re: [PATCH v7 10/12] sunrpc: add dst_attr attributes to the sysfs xprt directory To: Dan Aloni Cc: Trond Myklebust , Anna Schumaker , linux-nfs Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Sat, May 15, 2021 at 8:42 AM Dan Aloni wrote: > > On Fri, May 14, 2021 at 10:13:21AM -0400, Olga Kornievskaia wrote: > > From: Olga Kornievskaia > > > > Allow to query and set the destination's address of a transport. > > Setting of the destination address is allowed only for TCP or RDMA > > based connections. > > > > Signed-off-by: Olga Kornievskaia > .. > > + saddr = (struct sockaddr *)&xprt->addr; > > + port = rpc_get_port(saddr); > > + > > + dst_addr = kstrndup(buf, count - 1, GFP_KERNEL); > > + if (!dst_addr) > > + goto out_err; > > + saved_addr = kzalloc(sizeof(*saved_addr), GFP_KERNEL); > > + if (!saved_addr) > > + goto out_err_free; > > + saved_addr->addr = > > + rcu_dereference_raw(xprt->address_strings[RPC_DISPLAY_ADDR]); > > + rcu_assign_pointer(xprt->address_strings[RPC_DISPLAY_ADDR], dst_addr); > > + call_rcu(&saved_addr->rcu, free_xprt_addr); > > + xprt->addrlen = rpc_pton(xprt->xprt_net, buf, count - 1, saddr, > > + sizeof(*saddr)); > > Hi Olga, > > How does this behave if rpc_pton fails? Perhaps this conversion being > also a validation check on input given from user-space should be done > before the xprt is being modified? It's assumed that an administrator is providing a valid (and correct) address value. Transport would continue to be disconnected until a proper value is supplied. We can't validate for instance that the supplied value is a "correct" value for the v4.1 server (which would require sending an EXCHANGE_ID and checking that it's the same server as before). But yes perhaps a userland utility can do things like DNS resolution to get the IP, it can check format correctness and connectivity as well (but can't check the v4 requirement though). > > -- > Dan Aloni