Lines Matching defs:nd
171 static int nfsrv_checkgrace(struct nfsrv_descript *nd, struct nfsclient *clp,
176 static int nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp,
190 static int nfsrv_notsamecredname(int op, struct nfsrv_descript *nd,
194 static int nfsrv_checkseqid(struct nfsrv_descript *nd, u_int32_t seqid,
211 static int nfsrv_freesession(struct nfsrv_descript *nd, struct nfsdsession *sep,
213 static int nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp,
216 static int nfsrv_addlayout(struct nfsrv_descript *nd, struct nfslayout **lypp,
229 static void nfsrv_flexlayouterr(struct nfsrv_descript *nd, uint32_t *layp,
237 static struct nfslayout *nfsrv_filelayout(struct nfsrv_descript *nd, int iomode,
239 static struct nfslayout *nfsrv_flexlayout(struct nfsrv_descript *nd, int iomode,
246 static int nfsrv_checkmachcred(int op, struct nfsrv_descript *nd,
249 struct nfsrv_descript *nd, int delegate, int writedeleg, int readonly,
300 nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp,
328 ((nd->nd_flag & ND_GSS) != 0 && nfsrv_nogsscallback != 0))
368 if ((nd->nd_flag & ND_NFSV41) != 0 && confirmp->lval[1] != 0) {
395 if ((nd->nd_flag & ND_NFSV41) != 0) {
434 if (nfsrv_notsamecredname(NFSV4OP_EXCHANGEID, nd, clp)) {
508 if ((nd->nd_flag & ND_NFSV41) != 0) {
580 if ((nd->nd_flag & ND_NFSV41) != 0) {
628 if ((nd->nd_flag & ND_NFSV41) == 0) {
653 NFSEXITCODE2(error, nd);
663 struct nfsrv_descript *nd, NFSPROC_T *p)
680 if ((nd == NULL || (nd->nd_flag & ND_NFSV41) == 0 ||
701 clnt_bck_create(nd->nd_xprt->xp_socket,
717 if ((nd->nd_flag & ND_NFSV41) != 0) {
728 if (nd != NULL && (nd->nd_flag & ND_NFSV41) != 0 &&
731 if ((nd->nd_flag & ND_HASSEQUENCE) != 0) {
732 shp = NFSSESSIONHASH(nd->nd_sessionid);
734 sep = nfsrv_findsession(nd->nd_sessionid);
773 if ((nd->nd_flag & ND_NFSV41) != 0) {
791 } else if ((nd->nd_flag & ND_NFSV41) == 0 &&
795 nd, clp))
811 if (nfsrv_checkgrace(nd, clp, 0)) {
822 if ((nd->nd_flag & ND_NFSV41) != 0)
838 SVC_ACQUIRE(nd->nd_xprt);
840 nd->nd_xprt->xp_p2 = clp->lc_req.nr_client;
842 nd->nd_xprt->xp_idletimeout = 0;
843 nsep->sess_cbsess.nfsess_xprt = nd->nd_xprt;
873 if (nfsrv_notsamecredname(0, nd, clp)) {
878 stp->ls_uid == nd->nd_cred->cr_uid) {
907 NFSEXITCODE2(error, nd);
915 nfsrv_destroyclient(struct nfsrv_descript *nd, nfsquad_t clientid, NFSPROC_T *p)
946 error = nfsrv_checkmachcred(NFSV4OP_DESTROYCLIENTID, nd, clp);
985 NFSEXITCODE2(error, nd);
1821 struct nfsrv_descript *nd, NFSPROC_T *p)
1901 nfsrv_dolocallocks != 0 && nd->nd_repstat == 0) {
1944 (nfsquad_t)((u_quad_t)0), 0, nd, p);
1957 (nfsquad_t)((u_quad_t)0), 0, nd, p);
2011 error = nfsrv_checkseqid(nd, new_stp->ls_seq,
2027 if ((nd->nd_flag & ND_NFSV41) != 0)
2041 error = nfsrv_checkseqid(nd, new_stp->ls_seq,
2060 (((nd->nd_flag & ND_NFSV41) == 0 &&
2063 ((nd->nd_flag & ND_NFSV41) != 0 &&
2073 error = nfsrv_checkgrace(nd, clp, new_stp->ls_flags);
2094 if (error != 0 || nd->nd_repstat != 0 || reterr != 0) {
2096 if (nd->nd_repstat != 0)
2097 error = nd->nd_repstat;
2348 if ((nd->nd_flag & ND_NFSV41) != 0 && stateidp->seqid == 0)
2482 if ((nd->nd_flag & ND_NFSV41) != 0 && stateidp->seqid == 0)
2536 NFSEXITCODE2(error, nd);
2547 struct nfsstate *new_stp, vnode_t vp, struct nfsrv_descript *nd,
2589 (nfsquad_t)((u_quad_t)0), 0, nd, p);
2599 error = nfsrv_checkseqid(nd, new_stp->ls_seq, ownerstp,
2615 error = nfsrv_checkgrace(nd, clp, new_stp->ls_flags);
2681 (((nd->nd_flag & ND_NFSV41) != 0 &&
2792 NFSEXITCODE2(error, nd);
2800 nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp,
2858 (nfsquad_t)((u_quad_t)0), 0, nd, p);
2946 (((nd->nd_flag & ND_NFSV41) != 0 &&
3125 stp->ls_compref = nd->nd_compref;
3225 new_deleg->ls_compref = nd->nd_compref;
3311 if ((nd->nd_flag & ND_NFSV41) != 0 &&
3318 nfsrv_issuedelegation(vp, clp, nd, delegate, writedeleg,
3345 nfsrv_issuedelegation(vp, clp, nd, delegate, writedeleg,
3369 } else if ((nd->nd_flag & ND_NFSV41) != 0) {
3373 nfsrv_issuedelegation(vp, clp, nd, delegate, writedeleg,
3436 NFSEXITCODE2(error, nd);
3445 nfsv4stateid_t *stateidp, struct nfsrv_descript *nd, NFSPROC_T *p,
3468 (nfsquad_t)((u_quad_t)0), 0, nd, p);
3484 error = nfsrv_checkseqid(nd, new_stp->ls_seq,
3487 (((nd->nd_flag & ND_NFSV41) == 0 &&
3489 ((nd->nd_flag & ND_NFSV41) != 0 &&
3518 if ((nd->nd_flag & ND_NFSV41) != 0 && stateidp->seqid == 0)
3535 if ((nd->nd_flag & ND_NFSV41) != 0 &&
3570 if ((nd->nd_flag & ND_NFSV41) != 0 &&
3587 NFSEXITCODE2(error, nd);
3595 nfsrv_delegupdate(struct nfsrv_descript *nd, nfsquad_t clientid,
3628 (nfsquad_t)((u_quad_t)0), 0, nd, p);
3638 ((nd->nd_flag & ND_NFSV41) == 0 || stateidp->seqid != 0))
4016 nfsrv_checkseqid(struct nfsrv_descript *nd, u_int32_t seqid,
4021 if ((nd->nd_flag & ND_NFSV41) != 0)
4024 if (op != nd->nd_rp)
4034 if ((nd->nd_flag & ND_ERELOOKUP) != 0)
4053 nd->nd_rp = stp->ls_op;
4054 nd->nd_rp->rc_flag |= RC_INPROG;
4062 NFSEXITCODE2(error, nd);
4075 nfsrv_getclientipaddr(struct nfsrv_descript *nd, struct nfsclient *clp)
4106 error = nfsrv_mtostr(nd, addr, i);
4141 error = nfsm_advance(nd, NFSM_RNDUP(i), -1);
4184 error = nfsrv_mtostr(nd, addr, i);
4272 error = nfsm_advance(nd, NFSM_RNDUP(i), -1);
4278 switch (nd->nd_nam->sa_family) {
4281 sin = (struct sockaddr_in *)nd->nd_nam;
4291 sin6 = (struct sockaddr_in6 *)nd->nd_nam;
4304 NFSEXITCODE2(error, nd);
4376 nfsrv_checkgrace(struct nfsrv_descript *nd, struct nfsclient *clp,
4413 if (nd != NULL && clp != NULL &&
4414 (nd->nd_flag & ND_NFSV41) != 0 &&
4447 struct nfsrv_descript *nd;
4455 nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
4477 * First, fill in some of the fields of nd and cr.
4479 nd->nd_flag = ND_NFSV4;
4481 nd->nd_flag |= ND_KERBV;
4483 nd->nd_flag |= ND_NFSV41;
4485 nd->nd_flag |= ND_NFSV42;
4486 nd->nd_repstat = 0;
4498 nd->nd_mreq = nd->nd_mb = m;
4499 nd->nd_bpos = mtod(m, caddr_t);
4505 nd->nd_procnum = NFSV4PROC_CBCOMPOUND;
4506 error = nfsrv_cbcallargs(nd, clp, callback, NFSV4OP_CBGETATTR,
4509 m_freem(nd->nd_mreq);
4512 (void)nfsm_fhtom(NULL, nd, (u_int8_t *)fhp, NFSX_MYFH, 0);
4513 (void)nfsrv_putattrbit(nd, attrbitp);
4515 nd->nd_procnum = NFSV4PROC_CBCOMPOUND;
4516 error = nfsrv_cbcallargs(nd, clp, callback, NFSV4OP_CBRECALL,
4519 m_freem(nd->nd_mreq);
4531 (void)nfsm_fhtom(NULL, nd, (u_int8_t *)fhp, NFSX_MYFH, 0);
4534 nd->nd_procnum = NFSV4PROC_CBCOMPOUND;
4535 error = nfsrv_cbcallargs(nd, clp, callback,
4539 m_freem(nd->nd_mreq);
4550 (void)nfsm_fhtom(NULL, nd, (uint8_t *)fhp, NFSX_MYFH, 0);
4561 nd->nd_procnum = NFSV4PROC_CBNULL;
4565 m_freem(nd->nd_mreq);
4571 m_freem(nd->nd_mreq);
4589 } else if (nd->nd_procnum == NFSV4PROC_CBNULL)
4599 if ((nd->nd_flag & ND_NFSV41) != 0) {
4602 error = newnfs_request(nd, NULL, clp,
4639 error = newnfs_request(nd, NULL, clp, &clp->lc_req,
4671 if (nd->nd_repstat) {
4672 error = nd->nd_repstat;
4676 error = nfsv4_loadattr(nd, NULL, nap, NULL, NULL, 0,
4679 m_freem(nd->nd_mrep);
4689 free(nd, M_TEMP);
4698 nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp,
4706 (void)nfsm_strtom(nd, optag, len);
4708 if ((nd->nd_flag & ND_NFSV41) != 0) {
4709 if ((nd->nd_flag & ND_NFSV42) != 0)
4716 error = nfsv4_setcbsequence(nd, clp, 1, sepp, slotposp);
5455 nfsrv_checkremove(vnode_t vp, int remove, struct nfsrv_descript *nd,
5474 (nfsquad_t)((u_quad_t)0), 0, nd, p);
5677 nfsrv_checksetattr(vnode_t vp, struct nfsrv_descript *nd,
5704 stp->ls_uid = nd->nd_cred->cr_uid;
5710 stateidp, exp, nd, p);
5713 NFSEXITCODE2(error, nd);
5724 nfsrv_checkgetattr(struct nfsrv_descript *nd, vnode_t vp,
5787 if (nd->nd_compref == stp->ls_compref ||
5788 ((nd->nd_flag & ND_IMPLIEDCLID) &&
5789 clp->lc_clientid.qval == nd->nd_clientid.qval) ||
5790 nfsaddr2_match(clp->lc_req.nr_nam, nd->nd_nam)) {
5815 error = nfsvno_updfilerev(vp, nvap, nd, p);
5826 NFSEXITCODE2(error, nd);
5870 nfsrv_notsamecredname(int op, struct nfsrv_descript *nd, struct nfsclient *clp)
5874 if (op != 0 && nfsrv_checkmachcred(op, nd, clp) != 0)
5878 if ((nd->nd_flag & ND_NFSV41) != 0)
5881 if (nd->nd_flag & ND_GSS) {
5885 if (nd->nd_princlen != clp->lc_namelen ||
5886 NFSBCMP(nd->nd_principal, clp->lc_name,
5892 if (nd->nd_cred->cr_uid == clp->lc_uid)
5903 if (nd->nd_cred->cr_uid == clp->lc_uid || nd->nd_cred->cr_uid == 0)
6267 nfsrv_checksequence(struct nfsrv_descript *nd, uint32_t sequenceid,
6275 shp = NFSSESSIONHASH(nd->nd_sessionid);
6277 sep = nfsrv_findsession(nd->nd_sessionid);
6282 error = nfsv4_seqsession(sequenceid, nd->nd_slotid, *highest_slotidp,
6289 nd->nd_flag |= ND_SAVEREPLY;
6292 nd->nd_clientid.qval = sep->sess_clp->lc_clientid.qval;
6293 nd->nd_flag |= ND_IMPLIEDCLID;
6297 (nd->nd_flag & (ND_GSSINTEGRITY | ND_GSSPRIVACY)) != 0 &&
6298 nd->nd_princlen == sep->sess_clp->lc_namelen &&
6299 !NFSBCMP(sep->sess_clp->lc_name, nd->nd_principal,
6300 nd->nd_princlen)) {
6301 nd->nd_flag |= ND_MACHCRED;
6302 NFSSET_OPBIT(&nd->nd_allowops, &sep->sess_clp->lc_allowops);
6306 nd->nd_maxreq = sep->sess_maxreq;
6307 nd->nd_maxresp = sep->sess_maxresp;
6329 nfsrv_checkreclaimcomplete(struct nfsrv_descript *nd, int onefs)
6335 shp = NFSSESSIONHASH(nd->nd_sessionid);
6338 sep = nfsrv_findsession(nd->nd_sessionid);
6363 nfsrv_cache_session(struct nfsrv_descript *nd, struct mbuf **m)
6375 shp = NFSSESSIONHASH(nd->nd_sessionid);
6377 sep = nfsrv_findsession(nd->nd_sessionid);
6383 switch (nd->nd_nam->sa_family) {
6386 sin = (struct sockaddr_in *)nd->nd_nam;
6394 sin6 = (struct sockaddr_in6 *)nd->nd_nam;
6415 nfsv4_seqsess_cacherep(nd->nd_slotid, sep->sess_slots, nd->nd_repstat,
6441 nfsrv_destroysession(struct nfsrv_descript *nd, uint8_t *sessionid)
6446 if (!NFSBCMP(sessionid, nd->nd_sessionid, NFSX_V4SESSIONID) &&
6447 (nd->nd_flag & ND_HASSEQUENCE) != 0) {
6449 if ((nd->nd_flag & ND_LASTOP) == 0)
6462 error = nfsrv_freesession(nd, NULL, sessionid, false, NULL);
6464 nd->nd_flag &= ~ND_HASSEQUENCE;
6479 nfsrv_bindconnsess(struct nfsrv_descript *nd, uint8_t *sessionid, int *foreaftp)
6495 error = nfsrv_checkmachcred(NFSV4OP_BINDCONNTOSESS, nd, clp);
6506 clnt_bck_create(nd->nd_xprt->xp_socket,
6513 SVC_ACQUIRE(nd->nd_xprt);
6515 nd->nd_xprt->xp_p2 = clp->lc_req.nr_client;
6517 nd->nd_xprt->xp_idletimeout = 0;
6518 sep->sess_cbsess.nfsess_xprt = nd->nd_xprt;
6557 nfsrv_freesession(struct nfsrv_descript *nd, struct nfsdsession *sep,
6575 if (nd != NULL && nfsrv_checkmachcred(NFSV4OP_DESTROYSESSION,
6576 nd, sep->sess_clp) != 0) {
6620 nfsrv_freestateid(struct nfsrv_descript *nd, nfsv4stateid_t *stateidp,
6632 NULL, (nfsquad_t)((u_quad_t)0), 0, nd, p);
6665 nfsrv_teststateid(struct nfsrv_descript *nd, nfsv4stateid_t *stateidp,
6677 NULL, (nfsquad_t)((u_quad_t)0), 0, nd, p);
6691 nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp,
6712 nd->nd_slotseq = tl;
6713 nd->nd_slotid = *slotposp;
6714 nd->nd_flag |= ND_HASSLOTID;
6723 nd->nd_flag |= ND_HASSEQUENCE;
6781 nfsrv_layoutcommit(struct nfsrv_descript *nd, vnode_t vp, int layouttype,
6802 nfsrv_layoutget(struct nfsrv_descript *nd, vnode_t vp, struct nfsexstuff *exp,
6852 error = nfsrv_findlayout(&nd->nd_clientid, &fh, layouttype, p, &lyp);
6917 lyp = nfsrv_filelayout(nd, *iomode, &fh, dsfhp,
6923 lyp = nfsrv_flexlayout(nd, *iomode, mirrorcnt,
6936 error = nfsrv_addlayout(nd, &lyp, stateidp, layp, layoutlenp, p);
6950 nfsrv_filelayout(struct nfsrv_descript *nd, int iomode, fhandle_t *fhp,
6965 lyp->lay_clientid.qval = nd->nd_clientid.qval;
6998 nfsrv_flexlayout(struct nfsrv_descript *nd, int iomode, int mirrorcnt,
7014 lyp->lay_clientid.qval = nd->nd_clientid.qval;
7063 nfsrv_flexlayouterr(struct nfsrv_descript *nd, uint32_t *layp, int maxcnt,
7295 nfsrv_layoutreturn(struct nfsrv_descript *nd, vnode_t vp,
7326 error = nfsrv_findlayout(&nd->nd_clientid, &fh,
7368 nd->nd_clientid.qval &&
7383 nfsrv_flexlayouterr(nd, layp, maxcnt, p);
7385 nfsrv_freelayouts(&nd->nd_clientid,
7388 nfsrv_freelayouts(&nd->nd_clientid, NULL, layouttype, iomode);
7427 nfsrv_addlayout(struct nfsrv_descript *nd, struct nfslayout **lypp,
7436 KASSERT((nd->nd_flag & ND_IMPLIEDCLID) != 0,
7442 NULL, (nfsquad_t)((u_quad_t)0), 0, nd, p);
7460 nlyp->lay_clientid.qval == nd->nd_clientid.qval)
7715 struct nameidata nd;
7728 NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
7730 error = namei(&nd);
7734 if (nd.ni_vp->v_type != VDIR) {
7735 vput(nd.ni_vp);
7739 if (strcmp(nd.ni_vp->v_mount->mnt_vfc->vfc_name, "nfs") != 0) {
7740 vput(nd.ni_vp);
7755 ds->nfsdev_dvp = nd.ni_vp;
7756 ds->nfsdev_nmp = VFSTONFS(nd.ni_vp->v_mount);
7757 NFSVOPUNLOCK(nd.ni_vp);
7764 NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
7766 error = namei(&nd);
7770 if (nd.ni_vp->v_type != VDIR) {
7771 vput(nd.ni_vp);
7776 if (strcmp(nd.ni_vp->v_mount->mnt_vfc->vfc_name, "nfs") != 0) {
7777 vput(nd.ni_vp);
7782 ds->nfsdev_dsdir[i] = nd.ni_vp;
7783 NFSVOPUNLOCK(nd.ni_vp);
7792 NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
7794 error = namei(&nd);
7798 if (nd.ni_vp->v_type != VDIR) {
7799 vput(nd.ni_vp);
7804 mp = nd.ni_vp->v_mount;
7806 vput(nd.ni_vp);
7813 vput(nd.ni_vp);
8632 struct nameidata nd;
8651 NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
8653 error = namei(&nd);
8657 if (nd.ni_vp->v_type != VREG) {
8658 vput(nd.ni_vp);
8662 vp = nd.ni_vp;
8670 NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
8672 error = namei(&nd);
8678 if (nd.ni_vp->v_type != VDIR) {
8679 vput(nd.ni_vp);
8684 if (strcmp(nd.ni_vp->v_mount->mnt_vfc->vfc_name, "nfs") != 0) {
8685 vput(nd.ni_vp);
8690 curnmp = VFSTONFS(nd.ni_vp->v_mount);
8699 vput(nd.ni_vp);
8704 curvp = nd.ni_vp;
8710 NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
8712 error = namei(&nd);
8720 if (nd.ni_vp->v_type != VDIR || nd.ni_vp == curvp) {
8721 vput(nd.ni_vp);
8726 if (nd.ni_vp == curvp)
8730 if (strcmp(nd.ni_vp->v_mount->mnt_vfc->vfc_name, "nfs") != 0) {
8731 vput(nd.ni_vp);
8738 nmp = VFSTONFS(nd.ni_vp->v_mount);
8751 vput(nd.ni_vp);
8759 nd.ni_vp = NULL;
8774 if (nd.ni_vp == NULL) {
8789 vput(nd.ni_vp);
8915 nfsrv_checkmachcred(int op, struct nfsrv_descript *nd, struct nfsclient *clp)
8921 KASSERT((nd->nd_flag & ND_NFSV41) != 0,
8923 if ((nd->nd_flag & (ND_GSSINTEGRITY | ND_GSSPRIVACY)) != 0 &&
8924 nd->nd_princlen == clp->lc_namelen &&
8925 !NFSBCMP(nd->nd_principal, clp->lc_name, nd->nd_princlen))
8935 struct nfsrv_descript *nd, int delegate, int writedeleg, int readonly,
9000 new_deleg->ls_compref = nd->nd_compref;