From cf7fb4c3d4b0b7b7de39b198900d931ac61bd46f Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Mon, 25 Feb 2013 09:18:17 -0800 Subject: [PATCH] Add SIOCRDSGETTOS to get the current TOS for the socket Orabug: 16397197 Signed-off-by: Bang Nguyen (cherry picked from commit 201e2362694aab25b4ef6b11e5bd62b75b2a0e17) --- include/uapi/linux/rds.h | 1 + net/rds/af_rds.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h index ec0a19475a3b..1caffb379c3e 100644 --- a/include/uapi/linux/rds.h +++ b/include/uapi/linux/rds.h @@ -63,6 +63,7 @@ * ioctl commands for SOL_RDS */ #define SIOCRDSSETTOS (SIOCPROTOPRIVATE) +#define SIOCRDSGETTOS (SIOCPROTOPRIVATE + 1) typedef u_int8_t rds_tos_t; diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c index 48406609889c..5869a0434fe1 100644 --- a/net/rds/af_rds.c +++ b/net/rds/af_rds.c @@ -227,6 +227,13 @@ static int rds_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) rs->rs_tos = tos; spin_unlock_bh(&rds_sock_lock); break; + case SIOCRDSGETTOS: + spin_lock_bh(&rds_sock_lock); + tos = rs->rs_tos; + spin_unlock_bh(&rds_sock_lock); + if (put_user(tos, (rds_tos_t __user *)arg)) + return -EFAULT; + break; default: return -ENOIOCTLCMD; } -- 2.50.1