Some mount options pass in a string IP address. Let's parse these strings
in a separate function since this is done for at least two different mount
options.
This allows us to support IPv6 string addresses more easily in a subsequent
patch
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/super.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 1831394..c09c045 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -614,6 +614,16 @@ static int nfs_verify_server_address(struct sockaddr *addr)
}
/*
+ * Parse string addresses passed in via a mount option.
+ */
+static void nfs_parse_server_address(char *value,
+ struct sockaddr_in *addr)
+{
+ addr->sin_family = AF_INET;
+ addr->sin_addr.s_addr = in_aton(value);
+}
+
+/*
* Parse the value of the 'sec=' option.
*/
static int nfs_parse_security_flavors(char *value,
@@ -966,9 +976,8 @@ static int nfs_parse_mount_options(char *raw,
string = match_strdup(args);
if (string == NULL)
goto out_nomem;
- mnt->nfs_server.address.sin_family = AF_INET;
- mnt->nfs_server.address.sin_addr.s_addr =
- in_aton(string);
+ nfs_parse_server_address(string,
+ &mnt->nfs_server.address);
kfree(string);
break;
case Opt_clientaddr:
@@ -987,9 +996,8 @@ static int nfs_parse_mount_options(char *raw,
string = match_strdup(args);
if (string == NULL)
goto out_nomem;
- mnt->mount_server.address.sin_family = AF_INET;
- mnt->mount_server.address.sin_addr.s_addr =
- in_aton(string);
+ nfs_parse_server_address(string,
+ &mnt->mount_server.address);
kfree(string);
break;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html| Vladislav Bolkhovitin | Re: Integration of SCST in the mainstream Linux kernel |
| Eric Paris | [RFC 0/5] [TALPA] Intro to a linux interface for on access scanning |
| holzheu | Re: [RFC/PATCH] Documentation of kernel messages |
| debian developer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | [GIT]: Networking |
| Alan Cox | Re: [BUG] New Kernel Bugs |
