提交 51363b87 编写于 作者: U Ursula Braun 提交者: David S. Miller

af_iucv: allow retrieval of maximum message size

For HS transport the maximum message size depends on the MTU-size
of the HS-device bound to the AF_IUCV socket. This patch adds a
getsockopt option MSGSIZE returning the maximum message size that
can be handled for this AF_IUCV socket.
Signed-off-by: NUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: NFrank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 800c5eb7
...@@ -132,6 +132,7 @@ struct iucv_sock { ...@@ -132,6 +132,7 @@ struct iucv_sock {
/* iucv socket options (SOL_IUCV) */ /* iucv socket options (SOL_IUCV) */
#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
#define SO_MSGSIZE 0x0800 /* get maximum msgsize */
/* iucv related control messages (scm) */ /* iucv related control messages (scm) */
#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
......
...@@ -1633,7 +1633,8 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname, ...@@ -1633,7 +1633,8 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname,
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct iucv_sock *iucv = iucv_sk(sk); struct iucv_sock *iucv = iucv_sk(sk);
int val, len; unsigned int val;
int len;
if (level != SOL_IUCV) if (level != SOL_IUCV)
return -ENOPROTOOPT; return -ENOPROTOOPT;
...@@ -1656,6 +1657,13 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname, ...@@ -1656,6 +1657,13 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname,
: iucv->msglimit; /* default */ : iucv->msglimit; /* default */
release_sock(sk); release_sock(sk);
break; break;
case SO_MSGSIZE:
if (sk->sk_state == IUCV_OPEN)
return -EBADFD;
val = (iucv->hs_dev) ? iucv->hs_dev->mtu -
sizeof(struct af_iucv_trans_hdr) - ETH_HLEN :
0x7fffffff;
break;
default: default:
return -ENOPROTOOPT; return -ENOPROTOOPT;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册