diff options
-rw-r--r-- | net/rds/af_rds.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c index 04877441fb01..2ad9032372b2 100644 --- a/net/rds/af_rds.c +++ b/net/rds/af_rds.c @@ -339,6 +339,7 @@ static int rds_getsockopt(struct socket *sock, int level, int optname, { struct rds_sock *rs = rds_sk_to_rs(sock->sk); int ret = -ENOPROTOOPT, len; + int trans; if (level != SOL_RDS) goto out; @@ -364,6 +365,19 @@ static int rds_getsockopt(struct socket *sock, int level, int optname, else ret = 0; break; + case SO_RDS_TRANSPORT: + if (len < sizeof(int)) { + ret = -EINVAL; + break; + } + trans = (rs->rs_transport ? rs->rs_transport->t_type : + RDS_TRANS_NONE); /* unbound */ + if (put_user(trans, (int __user *)optval) || + put_user(sizeof(int), optlen)) + ret = -EFAULT; + else + ret = 0; + break; default: break; } |