Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 159516 Details for
Bug 248149
[RFE][PATCH] adding a mechanism to allow multihomed NFS clients to use a specific address
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch -- add new srcaddr option
linux-kernel-test.patch (text/plain), 6.97 KB, created by
Jeff Layton
on 2007-07-18 12:59:07 UTC
(
hide
)
Description:
patch -- add new srcaddr option
Filename:
MIME Type:
Creator:
Jeff Layton
Created:
2007-07-18 12:59:07 UTC
Size:
6.97 KB
patch
obsolete
>diff --git a/fs/nfs/client.c b/fs/nfs/client.c >index a49f9fe..e7e323c 100644 >--- a/fs/nfs/client.c >+++ b/fs/nfs/client.c >@@ -387,6 +387,9 @@ static int nfs_create_rpc_client(struct nfs_client *clp, int proto, > if (!IS_ERR(clp->cl_rpcclient)) > return 0; > >+ if (clp->cl_srcaddr.sin_family != AF_UNSPEC) >+ args.saddress = (struct sockaddr *)&clp->cl_srcaddr; >+ > nfs_init_timeout_values(&timeparms, proto, timeo, retrans); > clp->retrans_timeo = timeparms.to_initval; > clp->retrans_count = timeparms.to_retries; >@@ -518,6 +521,8 @@ static int nfs_init_client(struct nfs_client *clp, const struct nfs_mount_data * > if (clp->cl_nfsversion == 3) > clp->rpc_ops = &nfs_v3_clientops; > #endif >+ memcpy(&clp->cl_srcaddr, &data->srcaddr, sizeof(clp->cl_srcaddr)); >+ > /* > * Create a client RPC handle for doing FSSTAT with UNIX auth only > * - RFC 2623, sec 2.3.2 >@@ -872,7 +877,7 @@ error: > */ > static int nfs4_set_client(struct nfs_server *server, > const char *hostname, const struct sockaddr_in *addr, >- const char *ip_addr, >+ const struct sockaddr_in *srcaddr, const char *ip_addr, > rpc_authflavor_t authflavour, > int proto, int timeo, int retrans) > { >@@ -887,6 +892,8 @@ static int nfs4_set_client(struct nfs_server *server, > error = PTR_ERR(clp); > goto error; > } >+ if (srcaddr != NULL) >+ clp->cl_srcaddr = *srcaddr; > error = nfs4_init_client(clp, proto, timeo, retrans, ip_addr, authflavour); > if (error < 0) > goto error_put; >@@ -956,8 +963,10 @@ struct nfs_server *nfs4_create_server(const struct nfs4_mount_data *data, > return ERR_PTR(-ENOMEM); > > /* Get a client record */ >- error = nfs4_set_client(server, hostname, addr, ip_addr, authflavour, >- data->proto, data->timeo, data->retrans); >+ error = nfs4_set_client(server, hostname, addr, >+ (struct sockaddr_in *) &data->srcaddr, >+ ip_addr, authflavour, data->proto, data->timeo, >+ data->retrans); > if (error < 0) > goto error; > >@@ -1026,7 +1035,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data, > /* Get a client representation. > * Note: NFSv4 always uses TCP, */ > error = nfs4_set_client(server, data->hostname, data->addr, >- parent_client->cl_ipaddr, >+ NULL, parent_client->cl_ipaddr, > data->authflavor, > parent_server->client->cl_xprt->prot, > parent_client->retrans_timeo, >diff --git a/fs/nfs/super.c b/fs/nfs/super.c >index a2b1af8..111b87e 100644 >--- a/fs/nfs/super.c >+++ b/fs/nfs/super.c >@@ -81,6 +81,7 @@ struct nfs_parsed_mount_data { > > struct { > struct sockaddr_in address; >+ struct sockaddr_in source_address; > char *hostname; > char *export_path; > unsigned int program; >@@ -117,6 +118,7 @@ enum { > /* Mount options that take string arguments */ > Opt_sec, Opt_proto, Opt_mountproto, > Opt_addr, Opt_mounthost, Opt_clientaddr, >+ Opt_srcaddr, > > /* Mount options that are ignored */ > Opt_userspace, Opt_deprecated, >@@ -176,6 +178,7 @@ static match_table_t nfs_mount_option_tokens = { > { Opt_addr, "addr=%s" }, > { Opt_clientaddr, "clientaddr=%s" }, > { Opt_mounthost, "mounthost=%s" }, >+ { Opt_srcaddr, "srcaddr=%s" }, > > { Opt_err, NULL } > }; >@@ -968,6 +971,15 @@ static int nfs_parse_mount_options(char *raw, > in_aton(string); > kfree(string); > break; >+ case Opt_srcaddr: >+ string = match_strdup(args); >+ if (string == NULL) >+ goto out_nomem; >+ mnt->nfs_server.source_address.sin_family = AF_INET; >+ mnt->nfs_server.source_address.sin_addr.s_addr = >+ in_aton(string); >+ kfree(string); >+ break; > > case Opt_userspace: > case Opt_deprecated: >@@ -1133,6 +1145,8 @@ static int nfs_validate_mount_data(struct nfs_mount_data **options, > .mount_server.program = NFS_MNT_PROGRAM, > .nfs_server.protocol = IPPROTO_TCP, > .nfs_server.program = NFS_PROGRAM, >+ .nfs_server.source_address.sin_family = AF_INET, >+ .nfs_server.source_address.sin_addr.s_addr = INADDR_ANY, > }; > > if (nfs_parse_mount_options((char *) *options, &args) == 0) >@@ -1185,6 +1199,9 @@ static int nfs_validate_mount_data(struct nfs_mount_data **options, > data->bsize = args.bsize; > data->pseudoflavor = args.auth_flavors[0]; > >+ memcpy(&data->srcaddr, &args.nfs_server.source_address, >+ sizeof(data->srcaddr)); >+ > break; > } > } >@@ -1615,6 +1632,8 @@ static int nfs4_validate_mount_data(struct nfs4_mount_data **options, > .acdirmin = 30, > .acdirmax = 60, > .nfs_server.protocol = IPPROTO_TCP, >+ .nfs_server.source_address.sin_family = AF_INET, >+ .nfs_server.source_address.sin_addr.s_addr = INADDR_ANY, > }; > > if (nfs_parse_mount_options((char *) *options, &args) == 0) >@@ -1657,6 +1676,9 @@ static int nfs4_validate_mount_data(struct nfs4_mount_data **options, > data->acdirmax = args.acdirmax; > data->proto = args.nfs_server.protocol; > >+ memcpy(&data->srcaddr, &args.nfs_server.source_address, >+ sizeof(data->srcaddr)); >+ > /* > * Split "dev_name" into "hostname:mntpath". > */ >diff --git a/include/linux/nfs4_mount.h b/include/linux/nfs4_mount.h >index a0dcf66..ed32197 100644 >--- a/include/linux/nfs4_mount.h >+++ b/include/linux/nfs4_mount.h >@@ -9,6 +9,8 @@ > * structure passed from user-space to kernel-space during an nfsv4 mount > */ > >+#include <linux/socket.h> >+ > /* > * WARNING! Do not delete or change the order of these fields. If > * a new field is required then add it to the end. The version field >@@ -16,7 +18,7 @@ > * mount-to-kernel version compatibility. Some of these aren't used yet > * but here they are anyway. > */ >-#define NFS4_MOUNT_VERSION 1 >+#define NFS4_MOUNT_VERSION 2 > > struct nfs_string { > unsigned int len; >@@ -53,6 +55,9 @@ struct nfs4_mount_data { > /* Pseudo-flavours to use for authentication. See RFC2623 */ > int auth_flavourlen; /* 1 */ > int __user *auth_flavours; /* 1 */ >+ >+ /* preferred source address for socket */ >+ struct sockaddr srcaddr; /* 2 */ > }; > > /* bits in the flags field */ >diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h >index 0cac49b..90cd4dd 100644 >--- a/include/linux/nfs_fs_sb.h >+++ b/include/linux/nfs_fs_sb.h >@@ -20,6 +20,7 @@ struct nfs_client { > #define NFS_CS_IDMAP 2 /* - idmap started */ > #define NFS_CS_RENEWD 3 /* - renewd started */ > struct sockaddr_in cl_addr; /* server identifier */ >+ struct sockaddr_in cl_srcaddr; /* preferred source addr */ > char * cl_hostname; /* hostname of server */ > struct list_head cl_share_link; /* link in global client list */ > struct list_head cl_superblocks; /* List of nfs_server structs */ >diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h >index a3ade89..29a0516 100644 >--- a/include/linux/nfs_mount.h >+++ b/include/linux/nfs_mount.h >@@ -20,7 +20,7 @@ > * mount-to-kernel version compatibility. Some of these aren't used yet > * but here they are anyway. > */ >-#define NFS_MOUNT_VERSION 6 >+#define NFS_MOUNT_VERSION 7 > #define NFS_MAX_CONTEXT_LEN 256 > > struct nfs_mount_data { >@@ -43,6 +43,8 @@ struct nfs_mount_data { > struct nfs3_fh root; /* 4 */ > int pseudoflavor; /* 5 */ > char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */ >+ /* preferred src addr for NFS socket */ >+ struct sockaddr srcaddr; /* 7 */ > }; > > /* bits in the flags field */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 248149
:
159189
|
159363
| 159516