RFC3530 states: Where an NFS version 4 implementation supports operation over the IP network protocol, the supported transports between NFS and IP MUST be among the IETF-approved congestion control transport protocols, which include TCP and SCTP This patch makes nfsd_dispatch check for NFSv4 requests over UDP and reject them with a PROG_MISMATCH RPC error. It also has the NFS server skip rpcbind registration of the NFSv4 UDP port. Reported-by: Sachin Prabhu <sprabhu@xxxxxxxxxx> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx> --- fs/nfsd/nfs4proc.c | 1 + fs/nfsd/nfssvc.c | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 59ec449..4dfbf08 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1365,6 +1365,7 @@ struct svc_version nfsd_version4 = { .vs_proc = nfsd_procedures4, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS4_SVC_XDRSIZE, + .vs_hidden_udp = true, }; /* diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 6b59d32..9ae06ba 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -535,6 +535,13 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) rqstp->rq_vers, rqstp->rq_proc); proc = rqstp->rq_procinfo; + /* Reject any NFSv4 request over UDP. Don't bother caching it. */ + if (rqstp->rq_vers == 4 && rqstp->rq_prot == IPPROTO_UDP) { + dprintk("%s: rejecting vers 4 request over UDP\n", __func__); + *statp = rpc_prog_mismatch; + return 1; + } + /* Check whether we have this call in the cache. */ switch (nfsd_cache_lookup(rqstp, proc->pc_cachetype)) { case RC_INTR: -- 1.5.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html