FreeBSD Bugzilla – Attachment 164134 Details for
Bug 205193
jail accessing NFSv4 mount causes syslog spam
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
kernel changes to support nfsuserd using an AF_LOCAL socket
nfsuserd-aflocal-kern.patch (text/plain), 4.02 KB, created by
Rick Macklem
on 2015-12-11 22:01:43 UTC
(
hide
)
Description:
kernel changes to support nfsuserd using an AF_LOCAL socket
Filename:
MIME Type:
Creator:
Rick Macklem
Created:
2015-12-11 22:01:43 UTC
Size:
4.02 KB
patch
obsolete
>--- fs/nfs/nfs_commonkrpc.c.sav 2015-12-10 20:01:35.488317000 -0500 >+++ fs/nfs/nfs_commonkrpc.c 2015-12-10 20:04:40.903854000 -0500 >@@ -198,6 +198,8 @@ newnfs_connect(struct nfsmount *nmp, str > nconf = getnetconfigent("udp"); > else > nconf = getnetconfigent("tcp"); >+ else if (saddr->sa_family == AF_LOCAL) >+ nconf = getnetconfigent("local"); > else > if (nrp->nr_sotype == SOCK_DGRAM) > nconf = getnetconfigent("udp6"); >--- fs/nfs/nfs_commonsubs.c.sav 2015-12-10 20:09:25.218282000 -0500 >+++ fs/nfs/nfs_commonsubs.c 2015-12-11 17:16:10.912717000 -0500 >@@ -3048,7 +3048,7 @@ nfsrv_cmpmixedcase(u_char *cp, u_char *c > * Set the port for the nfsuserd. > */ > APPLESTATIC int >-nfsrv_nfsuserdport(u_short port, NFSPROC_T *p) >+nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, NFSPROC_T *p) > { > struct nfssockreq *rp; > struct sockaddr_in *ad; >@@ -3067,16 +3067,24 @@ nfsrv_nfsuserdport(u_short port, NFSPROC > */ > rp = &nfsrv_nfsuserdsock; > rp->nr_client = NULL; >- rp->nr_sotype = SOCK_DGRAM; >- rp->nr_soproto = IPPROTO_UDP; >- rp->nr_lock = (NFSR_RESERVEDPORT | NFSR_LOCALHOST); > rp->nr_cred = NULL; >- NFSSOCKADDRALLOC(rp->nr_nam); >- NFSSOCKADDRSIZE(rp->nr_nam, sizeof (struct sockaddr_in)); >- ad = NFSSOCKADDR(rp->nr_nam, struct sockaddr_in *); >- ad->sin_family = AF_INET; >- ad->sin_addr.s_addr = htonl((u_int32_t)0x7f000001); /* 127.0.0.1 */ >- ad->sin_port = port; >+ rp->nr_lock = (NFSR_RESERVEDPORT | NFSR_LOCALHOST); >+ if (sad != NULL) { >+ /* Use the AF_LOCAL socket address passed in. */ >+ rp->nr_sotype = SOCK_STREAM; >+ rp->nr_soproto = 0; >+ rp->nr_nam = sad; >+ } else { >+ /* Use the port# for a UDP socket (old nfsuserd). */ >+ rp->nr_sotype = SOCK_DGRAM; >+ rp->nr_soproto = IPPROTO_UDP; >+ NFSSOCKADDRALLOC(rp->nr_nam); >+ NFSSOCKADDRSIZE(rp->nr_nam, sizeof (struct sockaddr_in)); >+ ad = NFSSOCKADDR(rp->nr_nam, struct sockaddr_in *); >+ ad->sin_family = AF_INET; >+ ad->sin_addr.s_addr = htonl((u_int32_t)0x7f000001); >+ ad->sin_port = port; >+ } > rp->nr_prog = RPCPROG_NFSUSERD; > rp->nr_vers = RPCNFSUSERD_VERS; > error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0); >--- fs/nfs/nfs_var.h.sav 2015-12-10 20:36:01.369536000 -0500 >+++ fs/nfs/nfs_var.h 2015-12-10 20:36:22.446237000 -0500 >@@ -128,7 +128,7 @@ int nfsrv_checksetattr(vnode_t, struct n > NFSPROC_T *); > int nfsrv_checkgetattr(struct nfsrv_descript *, vnode_t, > struct nfsvattr *, nfsattrbit_t *, struct ucred *, NFSPROC_T *); >-int nfsrv_nfsuserdport(u_short, NFSPROC_T *); >+int nfsrv_nfsuserdport(struct sockaddr *, u_short, NFSPROC_T *); > void nfsrv_nfsuserddelport(void); > void nfsrv_throwawayallstate(NFSPROC_T *); > int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *, >--- fs/nfs/nfs_commonport.c.sav 2015-12-10 20:36:56.465656000 -0500 >+++ fs/nfs/nfs_commonport.c 2015-12-11 17:15:30.025307000 -0500 >@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD: head/sys/fs/nfs/nfs_ > */ > #include <fs/nfs/nfsport.h> > #include <sys/sysctl.h> >+#include <rpc/rpc_com.h> > #include <vm/vm.h> > #include <vm/vm_object.h> > #include <vm/vm_page.h> >@@ -534,11 +535,30 @@ nfssvc_call(struct thread *p, struct nfs > goto out; > } else if (uap->flag & NFSSVC_NFSUSERDPORT) { > u_short sockport; >+ struct sockaddr *sad; >+ struct sockaddr_un *sun; > >- error = copyin(uap->argp, (caddr_t)&sockport, >- sizeof (u_short)); >- if (!error) >- error = nfsrv_nfsuserdport(sockport, p); >+ if ((uap->flag & NFSSVC_NEWSTRUCT) != 0) { >+ /* New nfsuserd using an AF_LOCAL socket. */ >+ sun = malloc(sizeof(struct sockaddr_un), M_SONAME, >+ M_WAITOK | M_ZERO); >+ error = copyinstr(uap->argp, sun->sun_path, >+ sizeof(sun->sun_path), NULL); >+ if (error != 0) { >+ free(sun, M_SONAME); >+ return (error); >+ } >+ sun->sun_family = AF_LOCAL; >+ sun->sun_len = SUN_LEN(sun); >+ sockport = 0; >+ sad = (struct sockaddr *)sun; >+ } else { >+ error = copyin(uap->argp, (caddr_t)&sockport, >+ sizeof (u_short)); >+ sad = NULL; >+ } >+ if (error == 0) >+ error = nfsrv_nfsuserdport(sad, sockport, p); > } else if (uap->flag & NFSSVC_NFSUSERDDELPORT) { > nfsrv_nfsuserddelport(); > error = 0;
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 205193
:
164098
|
164099
|
164134
|
183835
|
202117