Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/nfsserver/nfs_nfsdserv.c
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
static int nfsrv_linux42server = 1; | static int nfsrv_linux42server = 1; | ||||
SYSCTL_INT(_vfs_nfsd, OID_AUTO, linux42server, CTLFLAG_RW, | SYSCTL_INT(_vfs_nfsd, OID_AUTO, linux42server, CTLFLAG_RW, | ||||
&nfsrv_linux42server, 0, | &nfsrv_linux42server, 0, | ||||
"Enable Linux style NFSv4.2 server (non-RFC compliant)"); | "Enable Linux style NFSv4.2 server (non-RFC compliant)"); | ||||
static bool nfsrv_openaccess = true; | static bool nfsrv_openaccess = true; | ||||
SYSCTL_BOOL(_vfs_nfsd, OID_AUTO, v4openaccess, CTLFLAG_RW, | SYSCTL_BOOL(_vfs_nfsd, OID_AUTO, v4openaccess, CTLFLAG_RW, | ||||
&nfsrv_openaccess, 0, | &nfsrv_openaccess, 0, | ||||
"Enable Linux style NFSv4 Open access check"); | "Enable Linux style NFSv4 Open access check"); | ||||
static char nfsrv_scope[NFSV4_OPAQUELIMIT]; | |||||
SYSCTL_STRING(_vfs_nfsd, OID_AUTO, scope, CTLFLAG_RWTUN, | |||||
&nfsrv_scope, NFSV4_OPAQUELIMIT, "Server scope"); | |||||
static char nfsrv_owner_major[NFSV4_OPAQUELIMIT]; | |||||
SYSCTL_STRING(_vfs_nfsd, OID_AUTO, owner_major, CTLFLAG_RWTUN, | |||||
&nfsrv_owner_major, NFSV4_OPAQUELIMIT, "Server owner major"); | |||||
static uint64_t nfsrv_owner_minor; | |||||
SYSCTL_U64(_vfs_nfsd, OID_AUTO, owner_minor, CTLFLAG_RWTUN, | |||||
&nfsrv_owner_minor, 0, "Server owner minor"); | |||||
/* | /* | ||||
* This list defines the GSS mechanisms supported. | * This list defines the GSS mechanisms supported. | ||||
* (Don't ask me how you get these strings from the RFC stuff like | * (Don't ask me how you get these strings from the RFC stuff like | ||||
* iso(1), org(3)... but someone did it, so I don't need to know.) | * iso(1), org(3)... but someone did it, so I don't need to know.) | ||||
*/ | */ | ||||
static struct nfsgss_mechlist nfsgss_mechlist[] = { | static struct nfsgss_mechlist nfsgss_mechlist[] = { | ||||
{ 9, "\052\206\110\206\367\022\001\002\002", 11 }, | { 9, "\052\206\110\206\367\022\001\002\002", 11 }, | ||||
▲ Show 20 Lines • Show All 4,155 Lines • ▼ Show 20 Lines | nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
int error = 0, i, idlen; | int error = 0, i, idlen; | ||||
struct nfsclient *clp = NULL; | struct nfsclient *clp = NULL; | ||||
nfsquad_t clientid, confirm; | nfsquad_t clientid, confirm; | ||||
uint8_t *verf; | uint8_t *verf; | ||||
uint32_t sp4type, v41flags; | uint32_t sp4type, v41flags; | ||||
uint64_t owner_minor; | |||||
struct timespec verstime; | struct timespec verstime; | ||||
#ifdef INET | #ifdef INET | ||||
struct sockaddr_in *sin, *rin; | struct sockaddr_in *sin, *rin; | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
struct sockaddr_in6 *sin6, *rin6; | struct sockaddr_in6 *sin6, *rin6; | ||||
#endif | #endif | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
char *s; | |||||
if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) | if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) | ||||
goto nfsmout; | goto nfsmout; | ||||
NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF + NFSX_UNSIGNED); | NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF + NFSX_UNSIGNED); | ||||
verf = (uint8_t *)tl; | verf = (uint8_t *)tl; | ||||
tl += (NFSX_VERF / NFSX_UNSIGNED); | tl += (NFSX_VERF / NFSX_UNSIGNED); | ||||
i = fxdr_unsigned(int, *tl); | i = fxdr_unsigned(int, *tl); | ||||
if (i > NFSV4_OPAQUELIMIT || i <= 0) { | if (i > NFSV4_OPAQUELIMIT || i <= 0) { | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | if (nd->nd_repstat == 0) { | ||||
if (confirm.lval[1] != 0) | if (confirm.lval[1] != 0) | ||||
v41flags |= NFSV4EXCH_CONFIRMEDR; | v41flags |= NFSV4EXCH_CONFIRMEDR; | ||||
NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + 3 * NFSX_UNSIGNED); | NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + 3 * NFSX_UNSIGNED); | ||||
*tl++ = clientid.lval[0]; /* ClientID */ | *tl++ = clientid.lval[0]; /* ClientID */ | ||||
*tl++ = clientid.lval[1]; | *tl++ = clientid.lval[1]; | ||||
*tl++ = txdr_unsigned(confirm.lval[0]); /* SequenceID */ | *tl++ = txdr_unsigned(confirm.lval[0]); /* SequenceID */ | ||||
*tl++ = txdr_unsigned(v41flags); /* Exch flags */ | *tl++ = txdr_unsigned(v41flags); /* Exch flags */ | ||||
*tl++ = txdr_unsigned(NFSV4EXCH_SP4NONE); /* No SSV */ | *tl++ = txdr_unsigned(NFSV4EXCH_SP4NONE); /* No SSV */ | ||||
owner_minor = 0; /* Owner */ | txdr_hyper(nfsrv_owner_minor, tl); /* Owner Minor */ | ||||
txdr_hyper(owner_minor, tl); /* Minor */ | if (nfsrv_owner_major[0] != 0) | ||||
(void)nfsm_strtom(nd, nd->nd_cred->cr_prison->pr_hostuuid, | s = nfsrv_owner_major; | ||||
strlen(nd->nd_cred->cr_prison->pr_hostuuid)); /* Major */ | else | ||||
(void)nfsm_strtom(nd, nd->nd_cred->cr_prison->pr_hostuuid, | s = nd->nd_cred->cr_prison->pr_hostuuid; | ||||
strlen(nd->nd_cred->cr_prison->pr_hostuuid)); /* Scope */ | nfsm_strtom(nd, s, strlen(s)); /* Owner Major */ | ||||
if (nfsrv_scope[0] != 0) | |||||
s = nfsrv_scope; | |||||
else | |||||
s = nd->nd_cred->cr_prison->pr_hostuuid; | |||||
nfsm_strtom(nd, s, strlen(s) ); /* Scope */ | |||||
NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); | NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); | ||||
rmacklem: Looks fine. You could drop the "(void)" in front of
nfsm_strtom(). That was a habit I picked up… | |||||
*tl = txdr_unsigned(1); | *tl = txdr_unsigned(1); | ||||
(void)nfsm_strtom(nd, "freebsd.org", strlen("freebsd.org")); | (void)nfsm_strtom(nd, "freebsd.org", strlen("freebsd.org")); | ||||
(void)nfsm_strtom(nd, version, strlen(version)); | (void)nfsm_strtom(nd, version, strlen(version)); | ||||
NFSM_BUILD(tl, uint32_t *, NFSX_V4TIME); | NFSM_BUILD(tl, uint32_t *, NFSX_V4TIME); | ||||
verstime.tv_sec = 1293840000; /* Jan 1, 2011 */ | verstime.tv_sec = 1293840000; /* Jan 1, 2011 */ | ||||
verstime.tv_nsec = 0; | verstime.tv_nsec = 0; | ||||
txdr_nfsv4time(&verstime, tl); | txdr_nfsv4time(&verstime, tl); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,738 Lines • Show Last 20 Lines |
Looks fine. You could drop the "(void)" in front of
nfsm_strtom(). That was a habit I picked up decades ago,
when gcc cared.