diff options
author | Ursula Braun <ursula.braun@de.ibm.com> | 2012-02-07 19:19:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-08 18:50:19 -0500 |
commit | 51363b8751a673a00ad48eea895266396d53fa52 (patch) | |
tree | ea8b4278a7a5115ee848bac4b33e5f0f44369488 | |
parent | 800c5eb7b5eba6cb2a32738d763fd59f0fbcdde4 (diff) |
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: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/iucv/af_iucv.h | 1 | ||||
-rw-r--r-- | net/iucv/af_iucv.c | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h index a1517887aeac..2e1d5ecc2d1b 100644 --- a/include/net/iucv/af_iucv.h +++ b/include/net/iucv/af_iucv.h | |||
@@ -132,6 +132,7 @@ struct iucv_sock { | |||
132 | /* iucv socket options (SOL_IUCV) */ | 132 | /* iucv socket options (SOL_IUCV) */ |
133 | #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ | 133 | #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ |
134 | #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ | 134 | #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ |
135 | #define SO_MSGSIZE 0x0800 /* get maximum msgsize */ | ||
135 | 136 | ||
136 | /* iucv related control messages (scm) */ | 137 | /* iucv related control messages (scm) */ |
137 | #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ | 138 | #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ |
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index fbce4a3126de..98d1f0ba7fe9 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c | |||
@@ -1633,7 +1633,8 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname, | |||
1633 | { | 1633 | { |
1634 | struct sock *sk = sock->sk; | 1634 | struct sock *sk = sock->sk; |
1635 | struct iucv_sock *iucv = iucv_sk(sk); | 1635 | struct iucv_sock *iucv = iucv_sk(sk); |
1636 | int val, len; | 1636 | unsigned int val; |
1637 | int len; | ||
1637 | 1638 | ||
1638 | if (level != SOL_IUCV) | 1639 | if (level != SOL_IUCV) |
1639 | return -ENOPROTOOPT; | 1640 | return -ENOPROTOOPT; |
@@ -1656,6 +1657,13 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname, | |||
1656 | : iucv->msglimit; /* default */ | 1657 | : iucv->msglimit; /* default */ |
1657 | release_sock(sk); | 1658 | release_sock(sk); |
1658 | break; | 1659 | break; |
1660 | case SO_MSGSIZE: | ||
1661 | if (sk->sk_state == IUCV_OPEN) | ||
1662 | return -EBADFD; | ||
1663 | val = (iucv->hs_dev) ? iucv->hs_dev->mtu - | ||
1664 | sizeof(struct af_iucv_trans_hdr) - ETH_HLEN : | ||
1665 | 0x7fffffff; | ||
1666 | break; | ||
1659 | default: | 1667 | default: |
1660 | return -ENOPROTOOPT; | 1668 | return -ENOPROTOOPT; |
1661 | } | 1669 | } |