aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 96a742308cee..9ec0ca1ef4ea 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -901,9 +901,16 @@ static void
901gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se) 901gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se)
902{ 902{
903 struct nfs4_cb_conn *cb = &clp->cl_cb_conn; 903 struct nfs4_cb_conn *cb = &clp->cl_cb_conn;
904 904 unsigned short expected_family;
905 /* Currently, we only support tcp for the callback channel */ 905
906 if ((se->se_callback_netid_len != 3) || memcmp((char *)se->se_callback_netid_val, "tcp", 3)) 906 /* Currently, we only support tcp and tcp6 for the callback channel */
907 if (se->se_callback_netid_len == 3 &&
908 !memcmp(se->se_callback_netid_val, "tcp", 3))
909 expected_family = AF_INET;
910 else if (se->se_callback_netid_len == 4 &&
911 !memcmp(se->se_callback_netid_val, "tcp6", 4))
912 expected_family = AF_INET6;
913 else
907 goto out_err; 914 goto out_err;
908 915
909 cb->cb_addrlen = rpc_uaddr2sockaddr(se->se_callback_addr_val, 916 cb->cb_addrlen = rpc_uaddr2sockaddr(se->se_callback_addr_val,
@@ -911,7 +918,7 @@ gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se)
911 (struct sockaddr *) &cb->cb_addr, 918 (struct sockaddr *) &cb->cb_addr,
912 sizeof(cb->cb_addr)); 919 sizeof(cb->cb_addr));
913 920
914 if (!cb->cb_addrlen || cb->cb_addr.ss_family != AF_INET) 921 if (!cb->cb_addrlen || cb->cb_addr.ss_family != expected_family)
915 goto out_err; 922 goto out_err;
916 923
917 cb->cb_minorversion = 0; 924 cb->cb_minorversion = 0;