Changeset View
Changeset View
Standalone View
Standalone View
sys/nfs/nfs_nfssvc.c
Show All 37 Lines | |||||
#include "opt_nfs.h" | #include "opt_nfs.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/sysproto.h> | #include <sys/sysproto.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/jail.h> | |||||
#include <sys/priv.h> | #include <sys/priv.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/sysent.h> | #include <sys/sysent.h> | ||||
#include <sys/syscall.h> | #include <sys/syscall.h> | ||||
#include <sys/sysproto.h> | #include <sys/sysproto.h> | ||||
#include <net/vnet.h> | |||||
#include <security/audit/audit.h> | #include <security/audit/audit.h> | ||||
#include <nfs/nfssvc.h> | #include <nfs/nfssvc.h> | ||||
static struct syscall_helper_data nfssvc_syscalls[] = { | static struct syscall_helper_data nfssvc_syscalls[] = { | ||||
SYSCALL_INIT_HELPER(nfssvc), | SYSCALL_INIT_HELPER(nfssvc), | ||||
SYSCALL_INIT_LAST | SYSCALL_INIT_LAST | ||||
}; | }; | ||||
Show All 22 Lines | sys_nfssvc(struct thread *td, struct nfssvc_args *uap) | ||||
AUDIT_ARG_CMD(uap->flag); | AUDIT_ARG_CMD(uap->flag); | ||||
/* Allow anyone to get the stats. */ | /* Allow anyone to get the stats. */ | ||||
if ((uap->flag & ~(NFSSVC_GETSTATS | NFSSVC_NEWSTRUCT)) != 0) { | if ((uap->flag & ~(NFSSVC_GETSTATS | NFSSVC_NEWSTRUCT)) != 0) { | ||||
error = priv_check(td, PRIV_NFS_DAEMON); | error = priv_check(td, PRIV_NFS_DAEMON); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifdef VNET_NFSD | |||||
CURVNET_SET(TD_TO_VNET(td)); | |||||
#endif | |||||
error = EINVAL; | error = EINVAL; | ||||
if ((uap->flag & (NFSSVC_ADDSOCK | NFSSVC_OLDNFSD | NFSSVC_NFSD)) && | if ((uap->flag & (NFSSVC_ADDSOCK | NFSSVC_OLDNFSD | NFSSVC_NFSD)) && | ||||
nfsd_call_nfsserver != NULL) | nfsd_call_nfsserver != NULL) | ||||
error = (*nfsd_call_nfsserver)(td, uap); | error = (*nfsd_call_nfsserver)(td, uap); | ||||
else if ((uap->flag & (NFSSVC_CBADDSOCK | NFSSVC_NFSCBD | | else if ((uap->flag & (NFSSVC_CBADDSOCK | NFSSVC_NFSCBD | | ||||
NFSSVC_DUMPMNTOPTS | NFSSVC_FORCEDISM)) && nfsd_call_nfscl != NULL) | NFSSVC_DUMPMNTOPTS | NFSSVC_FORCEDISM)) && nfsd_call_nfscl != NULL) | ||||
error = (*nfsd_call_nfscl)(td, uap); | error = (*nfsd_call_nfscl)(td, uap); | ||||
else if ((uap->flag & (NFSSVC_IDNAME | NFSSVC_GETSTATS | | else if ((uap->flag & (NFSSVC_IDNAME | NFSSVC_GETSTATS | | ||||
NFSSVC_GSSDADDPORT | NFSSVC_GSSDADDFIRST | NFSSVC_GSSDDELETEALL | | NFSSVC_GSSDADDPORT | NFSSVC_GSSDADDFIRST | NFSSVC_GSSDDELETEALL | | ||||
NFSSVC_NFSUSERDPORT | NFSSVC_NFSUSERDDELPORT)) && | NFSSVC_NFSUSERDPORT | NFSSVC_NFSUSERDDELPORT)) && | ||||
nfsd_call_nfscommon != NULL) | nfsd_call_nfscommon != NULL) | ||||
error = (*nfsd_call_nfscommon)(td, uap); | error = (*nfsd_call_nfscommon)(td, uap); | ||||
else if ((uap->flag & (NFSSVC_NFSDNFSD | NFSSVC_NFSDADDSOCK | | else if ((uap->flag & (NFSSVC_NFSDNFSD | NFSSVC_NFSDADDSOCK | | ||||
NFSSVC_PUBLICFH | NFSSVC_V4ROOTEXPORT | NFSSVC_NOPUBLICFH | | NFSSVC_PUBLICFH | NFSSVC_V4ROOTEXPORT | NFSSVC_NOPUBLICFH | | ||||
NFSSVC_STABLERESTART | NFSSVC_ADMINREVOKE | | NFSSVC_STABLERESTART | NFSSVC_ADMINREVOKE | | ||||
NFSSVC_DUMPCLIENTS | NFSSVC_DUMPLOCKS | NFSSVC_BACKUPSTABLE | | NFSSVC_DUMPCLIENTS | NFSSVC_DUMPLOCKS | NFSSVC_BACKUPSTABLE | | ||||
NFSSVC_SUSPENDNFSD | NFSSVC_RESUMENFSD | NFSSVC_PNFSDS)) && | NFSSVC_SUSPENDNFSD | NFSSVC_RESUMENFSD | NFSSVC_PNFSDS)) && | ||||
nfsd_call_nfsd != NULL) | nfsd_call_nfsd != NULL) | ||||
error = (*nfsd_call_nfsd)(td, uap); | error = (*nfsd_call_nfsd)(td, uap); | ||||
if (error == EINTR || error == ERESTART) | if (error == EINTR || error == ERESTART) | ||||
error = 0; | error = 0; | ||||
#ifdef VNET_NFSD | |||||
CURVNET_RESTORE(); | |||||
#endif | |||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Called once to initialize data structures... | * Called once to initialize data structures... | ||||
*/ | */ | ||||
static int | static int | ||||
nfssvc_modevent(module_t mod, int type, void *data) | nfssvc_modevent(module_t mod, int type, void *data) | ||||
Show All 32 Lines |