nfscl: Disable use of callbacks for NFSv4.0
The only use for callbacks for NFSv4.0 is delegations and delegations rarely work well for NFSv4.0 anyhow. Therefore, this patch disables callbacks for the NFSv4.0 client. This is the same behavior as occurred when the nfscbd(8) daemon was not running. This change allowed a function called nfscl_getmyip() to be removed from the kernel, which is nice since maintaining this function was bothersome, due to its use of routing, etc. MFC after: 2 weeks
This commit is contained in:
@@ -62,7 +62,6 @@ int newnfs_numnfsd = 0;
|
|||||||
struct nfsstatsv1 nfsstatsv1;
|
struct nfsstatsv1 nfsstatsv1;
|
||||||
int nfs_numnfscbd = 0;
|
int nfs_numnfscbd = 0;
|
||||||
int nfscl_debuglevel = 0;
|
int nfscl_debuglevel = 0;
|
||||||
char nfsv4_callbackaddr[INET6_ADDRSTRLEN];
|
|
||||||
int nfsrv_lughashsize = 100;
|
int nfsrv_lughashsize = 100;
|
||||||
struct mtx nfsrv_dslock_mtx;
|
struct mtx nfsrv_dslock_mtx;
|
||||||
struct nfsdevicehead nfsrv_devidhead;
|
struct nfsdevicehead nfsrv_devidhead;
|
||||||
@@ -90,9 +89,6 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_test, CTLFLAG_RW, &nfs_realign_test,
|
|||||||
0, "Number of realign tests done");
|
0, "Number of realign tests done");
|
||||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_count, CTLFLAG_RW, &nfs_realign_count,
|
SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_count, CTLFLAG_RW, &nfs_realign_count,
|
||||||
0, "Number of mbuf realignments done");
|
0, "Number of mbuf realignments done");
|
||||||
SYSCTL_STRING(_vfs_nfs, OID_AUTO, callback_addr, CTLFLAG_RW,
|
|
||||||
nfsv4_callbackaddr, sizeof(nfsv4_callbackaddr),
|
|
||||||
"NFSv4 callback addr for server to use");
|
|
||||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, debuglevel, CTLFLAG_RW, &nfscl_debuglevel,
|
SYSCTL_INT(_vfs_nfs, OID_AUTO, debuglevel, CTLFLAG_RW, &nfscl_debuglevel,
|
||||||
0, "Debug level for NFS client");
|
0, "Debug level for NFS client");
|
||||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, userhashsize, CTLFLAG_RDTUN, &nfsrv_lughashsize,
|
SYSCTL_INT(_vfs_nfs, OID_AUTO, userhashsize, CTLFLAG_RDTUN, &nfsrv_lughashsize,
|
||||||
|
|||||||
@@ -373,7 +373,6 @@ int nfsrpc_destroysession(struct nfsmount *, struct nfsclsession *,
|
|||||||
/* nfs_clcomsubs.c */
|
/* nfs_clcomsubs.c */
|
||||||
int nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int);
|
int nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int);
|
||||||
struct mbuf *nfsm_uiombuflist(struct uio *, int, u_int);
|
struct mbuf *nfsm_uiombuflist(struct uio *, int, u_int);
|
||||||
u_int8_t *nfscl_getmyip(struct nfsmount *, struct in6_addr *, int *);
|
|
||||||
int nfsm_getfh(struct nfsrv_descript *, struct nfsfh **);
|
int nfsm_getfh(struct nfsrv_descript *, struct nfsfh **);
|
||||||
int nfscl_mtofh(struct nfsrv_descript *, struct nfsfh **,
|
int nfscl_mtofh(struct nfsrv_descript *, struct nfsfh **,
|
||||||
struct nfsvattr *, int *);
|
struct nfsvattr *, int *);
|
||||||
|
|||||||
@@ -34,8 +34,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include "opt_inet.h"
|
|
||||||
#include "opt_inet6.h"
|
|
||||||
|
|
||||||
#include <sys/capsicum.h>
|
#include <sys/capsicum.h>
|
||||||
|
|
||||||
@@ -47,11 +45,6 @@
|
|||||||
#include <sys/hash.h>
|
#include <sys/hash.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <fs/nfs/nfsport.h>
|
#include <fs/nfs/nfsport.h>
|
||||||
#include <netinet/in_fib.h>
|
|
||||||
#include <netinet/if_ether.h>
|
|
||||||
#include <netinet6/ip6_var.h>
|
|
||||||
#include <net/if_types.h>
|
|
||||||
#include <net/route/nhop.h>
|
|
||||||
|
|
||||||
#include <fs/nfsclient/nfs_kdtrace.h>
|
#include <fs/nfsclient/nfs_kdtrace.h>
|
||||||
|
|
||||||
@@ -1046,78 +1039,6 @@ nfscl_loadfsinfo(struct nfsmount *nmp, struct nfsfsinfo *fsp,
|
|||||||
nmp->nm_state |= NFSSTA_GOTFSINFO;
|
nmp->nm_state |= NFSSTA_GOTFSINFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Lookups source address which should be used to communicate with
|
|
||||||
* @nmp and stores it inside @pdst.
|
|
||||||
*
|
|
||||||
* Returns 0 on success.
|
|
||||||
*/
|
|
||||||
u_int8_t *
|
|
||||||
nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *paddr, int *isinet6p)
|
|
||||||
{
|
|
||||||
#if defined(INET6) || defined(INET)
|
|
||||||
int fibnum;
|
|
||||||
|
|
||||||
fibnum = curthread->td_proc->p_fibnum;
|
|
||||||
#endif
|
|
||||||
#ifdef INET
|
|
||||||
if (nmp->nm_nam->sa_family == AF_INET) {
|
|
||||||
struct epoch_tracker et;
|
|
||||||
struct nhop_object *nh;
|
|
||||||
struct sockaddr_in *sin;
|
|
||||||
struct in_addr addr = {};
|
|
||||||
|
|
||||||
sin = (struct sockaddr_in *)nmp->nm_nam;
|
|
||||||
NET_EPOCH_ENTER(et);
|
|
||||||
CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred));
|
|
||||||
nh = fib4_lookup(fibnum, sin->sin_addr, 0, NHR_NONE, 0);
|
|
||||||
if (nh != NULL) {
|
|
||||||
addr = IA_SIN(ifatoia(nh->nh_ifa))->sin_addr;
|
|
||||||
if (IN_LOOPBACK(ntohl(addr.s_addr))) {
|
|
||||||
/* Ignore loopback addresses */
|
|
||||||
nh = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CURVNET_RESTORE();
|
|
||||||
NET_EPOCH_EXIT(et);
|
|
||||||
|
|
||||||
if (nh == NULL)
|
|
||||||
return (NULL);
|
|
||||||
*isinet6p = 0;
|
|
||||||
*((struct in_addr *)paddr) = addr;
|
|
||||||
|
|
||||||
return (u_int8_t *)paddr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef INET6
|
|
||||||
if (nmp->nm_nam->sa_family == AF_INET6) {
|
|
||||||
struct epoch_tracker et;
|
|
||||||
struct sockaddr_in6 *sin6;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
sin6 = (struct sockaddr_in6 *)nmp->nm_nam;
|
|
||||||
|
|
||||||
NET_EPOCH_ENTER(et);
|
|
||||||
CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred));
|
|
||||||
error = in6_selectsrc_addr(fibnum, &sin6->sin6_addr,
|
|
||||||
sin6->sin6_scope_id, NULL, paddr, NULL);
|
|
||||||
CURVNET_RESTORE();
|
|
||||||
NET_EPOCH_EXIT(et);
|
|
||||||
if (error != 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
if (IN6_IS_ADDR_LOOPBACK(paddr))
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
/* Scope is embedded in */
|
|
||||||
*isinet6p = 1;
|
|
||||||
|
|
||||||
return (u_int8_t *)paddr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy NFS uid, gids from the cred structure.
|
* Copy NFS uid, gids from the cred structure.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ extern struct timeval nfsboottime;
|
|||||||
extern u_int32_t newnfs_false, newnfs_true;
|
extern u_int32_t newnfs_false, newnfs_true;
|
||||||
extern nfstype nfsv34_type[9];
|
extern nfstype nfsv34_type[9];
|
||||||
extern int nfsrv_useacl;
|
extern int nfsrv_useacl;
|
||||||
extern char nfsv4_callbackaddr[INET6_ADDRSTRLEN];
|
|
||||||
extern int nfscl_debuglevel;
|
extern int nfscl_debuglevel;
|
||||||
extern int nfs_pnfsiothreads;
|
extern int nfs_pnfsiothreads;
|
||||||
extern u_long sb_max_adj;
|
extern u_long sb_max_adj;
|
||||||
@@ -1040,13 +1039,10 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclclient *clp, int reclaim,
|
|||||||
u_int32_t *tl;
|
u_int32_t *tl;
|
||||||
struct nfsrv_descript nfsd;
|
struct nfsrv_descript nfsd;
|
||||||
struct nfsrv_descript *nd = &nfsd;
|
struct nfsrv_descript *nd = &nfsd;
|
||||||
u_int8_t *cp = NULL, *cp2, addr[INET6_ADDRSTRLEN + 9];
|
int error;
|
||||||
u_short port;
|
|
||||||
int error, isinet6 = 0, callblen;
|
|
||||||
nfsquad_t confirm;
|
nfsquad_t confirm;
|
||||||
static u_int32_t rev = 0;
|
static u_int32_t rev = 0;
|
||||||
struct nfsclds *dsp, *odsp;
|
struct nfsclds *dsp, *odsp;
|
||||||
struct in6_addr a6;
|
|
||||||
struct nfsclsession *tsep;
|
struct nfsclsession *tsep;
|
||||||
struct rpc_reconupcall recon;
|
struct rpc_reconupcall recon;
|
||||||
struct nfscl_reconarg *rcp;
|
struct nfscl_reconarg *rcp;
|
||||||
@@ -1204,49 +1200,13 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclclient *clp, int reclaim,
|
|||||||
(void) nfsm_strtom(nd, clp->nfsc_id, clp->nfsc_idlen);
|
(void) nfsm_strtom(nd, clp->nfsc_id, clp->nfsc_idlen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set up the callback address
|
* Always set the callback address to 0.0.0.0.0.0 so NFSv4.0
|
||||||
|
* callbacks are disabled.
|
||||||
*/
|
*/
|
||||||
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
|
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||||
*tl = txdr_unsigned(NFS_CALLBCKPROG);
|
*tl = txdr_unsigned(NFS_CALLBCKPROG);
|
||||||
callblen = strlen(nfsv4_callbackaddr);
|
(void)nfsm_strtom(nd, "tcp", 3);
|
||||||
if (callblen == 0)
|
(void)nfsm_strtom(nd, "0.0.0.0.0.0", 11);
|
||||||
cp = nfscl_getmyip(nmp, &a6, &isinet6);
|
|
||||||
if (nfscl_enablecallb && nfs_numnfscbd > 0 &&
|
|
||||||
(callblen > 0 || cp != NULL)) {
|
|
||||||
port = htons(nfsv4_cbport);
|
|
||||||
cp2 = (u_int8_t *)&port;
|
|
||||||
#ifdef INET6
|
|
||||||
if ((callblen > 0 &&
|
|
||||||
strchr(nfsv4_callbackaddr, ':')) || isinet6) {
|
|
||||||
char ip6buf[INET6_ADDRSTRLEN], *ip6add;
|
|
||||||
|
|
||||||
(void) nfsm_strtom(nd, "tcp6", 4);
|
|
||||||
if (callblen == 0) {
|
|
||||||
ip6_sprintf(ip6buf, (struct in6_addr *)cp);
|
|
||||||
ip6add = ip6buf;
|
|
||||||
} else {
|
|
||||||
ip6add = nfsv4_callbackaddr;
|
|
||||||
}
|
|
||||||
snprintf(addr, INET6_ADDRSTRLEN + 9, "%s.%d.%d",
|
|
||||||
ip6add, cp2[0], cp2[1]);
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
(void) nfsm_strtom(nd, "tcp", 3);
|
|
||||||
if (callblen == 0)
|
|
||||||
snprintf(addr, INET6_ADDRSTRLEN + 9,
|
|
||||||
"%d.%d.%d.%d.%d.%d", cp[0], cp[1],
|
|
||||||
cp[2], cp[3], cp2[0], cp2[1]);
|
|
||||||
else
|
|
||||||
snprintf(addr, INET6_ADDRSTRLEN + 9,
|
|
||||||
"%s.%d.%d", nfsv4_callbackaddr,
|
|
||||||
cp2[0], cp2[1]);
|
|
||||||
}
|
|
||||||
(void) nfsm_strtom(nd, addr, strlen(addr));
|
|
||||||
} else {
|
|
||||||
(void) nfsm_strtom(nd, "tcp", 3);
|
|
||||||
(void) nfsm_strtom(nd, "0.0.0.0.0.0", 11);
|
|
||||||
}
|
|
||||||
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
|
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||||
*tl = txdr_unsigned(clp->nfsc_cbident);
|
*tl = txdr_unsigned(clp->nfsc_cbident);
|
||||||
nd->nd_flag |= ND_USEGSSNAME;
|
nd->nd_flag |= ND_USEGSSNAME;
|
||||||
|
|||||||
Reference in New Issue
Block a user