[RFC PATCH 7/7] sunrpc: Connect to a new IP address provided by the user

schumaker.anna
2021-01-11T21:43:33Z

We preserve the same port number, rather than providing a way to change
it. This keeps the implementation simpler for now.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
net/sunrpc/sysfs.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c
index 537d83635670..47a7c9b8b143 100644
--- a/net/sunrpc/sysfs.c
+++ b/net/sunrpc/sysfs.c
@@ -70,6 +70,13 @@ static ssize_t rpc_netns_address_show(struct kobject *kobj,
static ssize_t rpc_netns_address_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
+ struct rpc_netns_client *c = container_of(kobj,
+ struct rpc_netns_client, kobject);
+ struct rpc_clnt *clnt = c->clnt;
+ struct rpc_xprt *xprt = rcu_dereference(clnt->cl_xprt);
+ struct sockaddr *saddr = (struct sockaddr *)&xprt->addr;
+
+ xprt->addrlen = rpc_pton(xprt->xprt_net, buf, count - 1, saddr, sizeof(*saddr));
return count;
}

--
2.29.2