Revert r320698, since the related userland changes were reverted by r338192.
r338192 reverted the changes to nfsuserd so that it could use an AF_LOCAL socket, since it resulted in a vnode locking panic(). Post r338192 nfsuserd daemons use the old AF_INET socket for upcalls and do not use these kernel changes. I left them in for a while, so that nfsuserd daemons built from head sources between r320757 (Jul. 6, 2017) and r338192 (Aug. 22, 2018) would need them by default. This only affects head, since the changes were never MFC'd. I will add an UPDATING entry, since an nfsuserd daemon built from head sources between r320757 and r338192 will not run unless the "-use-udpsock" option is specified. (This command line option is only in the affected revisions of the nfsuserd daemon.) I suspect few will be affected by this, since most who run systems built from head sources (not stable or releases) will have rebuilt their nfsuserd daemon from sources post r338192 (Aug. 22, 2018) This is being reverted in preparation for an update to include AF_INET6 support to the code.
This commit is contained in:
parent
2bf0ee64f9
commit
02c8dd7d72
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345895
@ -208,8 +208,6 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp,
|
||||
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");
|
||||
|
@ -631,30 +631,14 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, struct ucred *cred)
|
||||
goto out;
|
||||
} else if (uap->flag & NFSSVC_NFSUSERDPORT) {
|
||||
u_short sockport;
|
||||
struct sockaddr *sad;
|
||||
struct sockaddr_un *sun;
|
||||
|
||||
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 {
|
||||
if ((uap->flag & NFSSVC_NEWSTRUCT) == 0)
|
||||
error = copyin(uap->argp, (caddr_t)&sockport,
|
||||
sizeof (u_short));
|
||||
sad = NULL;
|
||||
}
|
||||
if (error == 0)
|
||||
error = nfsrv_nfsuserdport(sad, sockport, p);
|
||||
else
|
||||
error = ENXIO;
|
||||
if (!error)
|
||||
error = nfsrv_nfsuserdport(sockport, p);
|
||||
} else if (uap->flag & NFSSVC_NFSUSERDDELPORT) {
|
||||
nfsrv_nfsuserddelport();
|
||||
error = 0;
|
||||
|
@ -3504,7 +3504,7 @@ nfsrv_cmpmixedcase(u_char *cp, u_char *cp2, int len)
|
||||
* Set the port for the nfsuserd.
|
||||
*/
|
||||
APPLESTATIC int
|
||||
nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, NFSPROC_T *p)
|
||||
nfsrv_nfsuserdport(u_short port, NFSPROC_T *p)
|
||||
{
|
||||
struct nfssockreq *rp;
|
||||
struct sockaddr_in *ad;
|
||||
@ -3514,7 +3514,6 @@ nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, NFSPROC_T *p)
|
||||
if (nfsrv_nfsuserd) {
|
||||
NFSUNLOCKNAMEID();
|
||||
error = EPERM;
|
||||
free(sad, M_SONAME);
|
||||
goto out;
|
||||
}
|
||||
nfsrv_nfsuserd = 1;
|
||||
@ -3524,25 +3523,16 @@ nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, NFSPROC_T *p)
|
||||
*/
|
||||
rp = &nfsrv_nfsuserdsock;
|
||||
rp->nr_client = NULL;
|
||||
rp->nr_cred = NULL;
|
||||
rp->nr_sotype = SOCK_DGRAM;
|
||||
rp->nr_soproto = IPPROTO_UDP;
|
||||
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;
|
||||
rp->nr_nam = malloc(sizeof(*rp->nr_nam), M_SONAME, M_WAITOK |
|
||||
M_ZERO);
|
||||
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_cred = NULL;
|
||||
rp->nr_nam = malloc(sizeof(*rp->nr_nam), M_SONAME, M_WAITOK | M_ZERO);
|
||||
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_prog = RPCPROG_NFSUSERD;
|
||||
rp->nr_vers = RPCNFSUSERD_VERS;
|
||||
error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0);
|
||||
|
@ -136,7 +136,7 @@ int nfsrv_checksetattr(vnode_t, struct nfsrv_descript *,
|
||||
NFSPROC_T *);
|
||||
int nfsrv_checkgetattr(struct nfsrv_descript *, vnode_t,
|
||||
struct nfsvattr *, nfsattrbit_t *, NFSPROC_T *);
|
||||
int nfsrv_nfsuserdport(struct sockaddr *, u_short, NFSPROC_T *);
|
||||
int nfsrv_nfsuserdport(u_short, NFSPROC_T *);
|
||||
void nfsrv_nfsuserddelport(void);
|
||||
void nfsrv_throwawayallstate(NFSPROC_T *);
|
||||
int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *,
|
||||
|
Loading…
Reference in New Issue
Block a user