View | Details | Raw Unified | Return to bug 205193 | Differences between
and this patch

Collapse All | Expand All

(-)fs/nfs/nfs_commonkrpc.c (+2 lines)
Lines 198-203 newnfs_connect(struct nfsmount *nmp, str Link Here
198
			nconf = getnetconfigent("udp");
198
			nconf = getnetconfigent("udp");
199
		else
199
		else
200
			nconf = getnetconfigent("tcp");
200
			nconf = getnetconfigent("tcp");
201
	else if (saddr->sa_family == AF_LOCAL)
202
		nconf = getnetconfigent("local");
201
	else
203
	else
202
		if (nrp->nr_sotype == SOCK_DGRAM)
204
		if (nrp->nr_sotype == SOCK_DGRAM)
203
			nconf = getnetconfigent("udp6");
205
			nconf = getnetconfigent("udp6");
(-)fs/nfs/nfs_commonsubs.c (-10 / +18 lines)
Lines 3048-3054 nfsrv_cmpmixedcase(u_char *cp, u_char *c Link Here
3048
 * Set the port for the nfsuserd.
3048
 * Set the port for the nfsuserd.
3049
 */
3049
 */
3050
APPLESTATIC int
3050
APPLESTATIC int
3051
nfsrv_nfsuserdport(u_short port, NFSPROC_T *p)
3051
nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, NFSPROC_T *p)
3052
{
3052
{
3053
	struct nfssockreq *rp;
3053
	struct nfssockreq *rp;
3054
	struct sockaddr_in *ad;
3054
	struct sockaddr_in *ad;
Lines 3067-3082 nfsrv_nfsuserdport(u_short port, NFSPROC Link Here
3067
	 */
3067
	 */
3068
	rp = &nfsrv_nfsuserdsock;
3068
	rp = &nfsrv_nfsuserdsock;
3069
	rp->nr_client = NULL;
3069
	rp->nr_client = NULL;
3070
	rp->nr_sotype = SOCK_DGRAM;
3071
	rp->nr_soproto = IPPROTO_UDP;
3072
	rp->nr_lock = (NFSR_RESERVEDPORT | NFSR_LOCALHOST);
3073
	rp->nr_cred = NULL;
3070
	rp->nr_cred = NULL;
3074
	NFSSOCKADDRALLOC(rp->nr_nam);
3071
	rp->nr_lock = (NFSR_RESERVEDPORT | NFSR_LOCALHOST);
3075
	NFSSOCKADDRSIZE(rp->nr_nam, sizeof (struct sockaddr_in));
3072
	if (sad != NULL) {
3076
	ad = NFSSOCKADDR(rp->nr_nam, struct sockaddr_in *);
3073
		/* Use the AF_LOCAL socket address passed in. */
3077
	ad->sin_family = AF_INET;
3074
		rp->nr_sotype = SOCK_STREAM;
3078
	ad->sin_addr.s_addr = htonl((u_int32_t)0x7f000001);	/* 127.0.0.1 */
3075
		rp->nr_soproto = 0;
3079
	ad->sin_port = port;
3076
		rp->nr_nam = sad;
3077
	} else {
3078
		/* Use the port# for a UDP socket (old nfsuserd). */
3079
		rp->nr_sotype = SOCK_DGRAM;
3080
		rp->nr_soproto = IPPROTO_UDP;
3081
		NFSSOCKADDRALLOC(rp->nr_nam);
3082
		NFSSOCKADDRSIZE(rp->nr_nam, sizeof (struct sockaddr_in));
3083
		ad = NFSSOCKADDR(rp->nr_nam, struct sockaddr_in *);
3084
		ad->sin_family = AF_INET;
3085
		ad->sin_addr.s_addr = htonl((u_int32_t)0x7f000001);
3086
		ad->sin_port = port;
3087
	}
3080
	rp->nr_prog = RPCPROG_NFSUSERD;
3088
	rp->nr_prog = RPCPROG_NFSUSERD;
3081
	rp->nr_vers = RPCNFSUSERD_VERS;
3089
	rp->nr_vers = RPCNFSUSERD_VERS;
3082
	error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0);
3090
	error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0);
(-)fs/nfs/nfs_var.h (-1 / +1 lines)
Lines 128-134 int nfsrv_checksetattr(vnode_t, struct n Link Here
128
    NFSPROC_T *);
128
    NFSPROC_T *);
129
int nfsrv_checkgetattr(struct nfsrv_descript *, vnode_t,
129
int nfsrv_checkgetattr(struct nfsrv_descript *, vnode_t,
130
    struct nfsvattr *, nfsattrbit_t *, struct ucred *, NFSPROC_T *);
130
    struct nfsvattr *, nfsattrbit_t *, struct ucred *, NFSPROC_T *);
131
int nfsrv_nfsuserdport(u_short, NFSPROC_T *);
131
int nfsrv_nfsuserdport(struct sockaddr *, u_short, NFSPROC_T *);
132
void nfsrv_nfsuserddelport(void);
132
void nfsrv_nfsuserddelport(void);
133
void nfsrv_throwawayallstate(NFSPROC_T *);
133
void nfsrv_throwawayallstate(NFSPROC_T *);
134
int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *,
134
int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *,
(-)fs/nfs/nfs_commonport.c (-4 / +27 lines)
Lines 41-46 __FBSDID("$FreeBSD: head/sys/fs/nfs/nfs_ Link Here
41
 */
41
 */
42
#include <fs/nfs/nfsport.h>
42
#include <fs/nfs/nfsport.h>
43
#include <sys/sysctl.h>
43
#include <sys/sysctl.h>
44
#include <rpc/rpc_com.h>
44
#include <vm/vm.h>
45
#include <vm/vm.h>
45
#include <vm/vm_object.h>
46
#include <vm/vm_object.h>
46
#include <vm/vm_page.h>
47
#include <vm/vm_page.h>
Lines 534-544 nfssvc_call(struct thread *p, struct nfs Link Here
534
		goto out;
535
		goto out;
535
	} else if (uap->flag & NFSSVC_NFSUSERDPORT) {
536
	} else if (uap->flag & NFSSVC_NFSUSERDPORT) {
536
		u_short sockport;
537
		u_short sockport;
537
538
		struct sockaddr *sad;
538
		error = copyin(uap->argp, (caddr_t)&sockport,
539
		struct sockaddr_un *sun;
539
		    sizeof (u_short));
540
		char *path;
541
542
		if ((uap->flag & NFSSVC_NEWSTRUCT) != 0) {
543
			/* New nfsuserd using an AF_LOCAL socket. */
544
			path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
545
			error = copyinstr(uap->argp, path, MAXPATHLEN, NULL);
546
			if (error != 0) {
547
				free(path, M_TEMP);
548
				return (error);
549
			}
550
		
551
			sun = malloc(sizeof(struct sockaddr_un) + strlen(path),
552
			    M_SONAME, M_WAITOK | M_ZERO);
553
		        sun->sun_family = AF_LOCAL;
554
		        strcpy(sun->sun_path, path);
555
		        sun->sun_len = SUN_LEN(sun);
556
			sad = (struct sockaddr *)sun;
557
			free(path, M_TEMP);
558
		} else {
559
			error = copyin(uap->argp, (caddr_t)&sockport,
560
			    sizeof (u_short));
561
			sad = NULL;
562
		}
540
		if (!error)
563
		if (!error)
541
			error = nfsrv_nfsuserdport(sockport, p);
564
			error = nfsrv_nfsuserdport(sad, sockport, p);
542
	} else if (uap->flag & NFSSVC_NFSUSERDDELPORT) {
565
	} else if (uap->flag & NFSSVC_NFSUSERDDELPORT) {
543
		nfsrv_nfsuserddelport();
566
		nfsrv_nfsuserddelport();
544
		error = 0;
567
		error = 0;

Return to bug 205193