diff options
Diffstat (limited to 'net/iucv/af_iucv.c')
-rw-r--r-- | net/iucv/af_iucv.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index f0dea1b8ed4b..264c6b36931c 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c | |||
@@ -268,6 +268,7 @@ static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio) | |||
268 | skb_queue_head_init(&iucv_sk(sk)->backlog_skb_q); | 268 | skb_queue_head_init(&iucv_sk(sk)->backlog_skb_q); |
269 | iucv_sk(sk)->send_tag = 0; | 269 | iucv_sk(sk)->send_tag = 0; |
270 | iucv_sk(sk)->flags = 0; | 270 | iucv_sk(sk)->flags = 0; |
271 | iucv_sk(sk)->msglimit = IUCV_QUEUELEN_DEFAULT; | ||
271 | 272 | ||
272 | sk->sk_destruct = iucv_sock_destruct; | 273 | sk->sk_destruct = iucv_sock_destruct; |
273 | sk->sk_sndtimeo = IUCV_CONN_TIMEOUT; | 274 | sk->sk_sndtimeo = IUCV_CONN_TIMEOUT; |
@@ -536,7 +537,7 @@ static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr, | |||
536 | 537 | ||
537 | iucv = iucv_sk(sk); | 538 | iucv = iucv_sk(sk); |
538 | /* Create path. */ | 539 | /* Create path. */ |
539 | iucv->path = iucv_path_alloc(IUCV_QUEUELEN_DEFAULT, | 540 | iucv->path = iucv_path_alloc(iucv->msglimit, |
540 | IUCV_IPRMDATA, GFP_KERNEL); | 541 | IUCV_IPRMDATA, GFP_KERNEL); |
541 | if (!iucv->path) { | 542 | if (!iucv->path) { |
542 | err = -ENOMEM; | 543 | err = -ENOMEM; |
@@ -1219,6 +1220,20 @@ static int iucv_sock_setsockopt(struct socket *sock, int level, int optname, | |||
1219 | else | 1220 | else |
1220 | iucv->flags &= ~IUCV_IPRMDATA; | 1221 | iucv->flags &= ~IUCV_IPRMDATA; |
1221 | break; | 1222 | break; |
1223 | case SO_MSGLIMIT: | ||
1224 | switch (sk->sk_state) { | ||
1225 | case IUCV_OPEN: | ||
1226 | case IUCV_BOUND: | ||
1227 | if (val < 1 || val > (u16)(~0)) | ||
1228 | rc = -EINVAL; | ||
1229 | else | ||
1230 | iucv->msglimit = val; | ||
1231 | break; | ||
1232 | default: | ||
1233 | rc = -EINVAL; | ||
1234 | break; | ||
1235 | } | ||
1236 | break; | ||
1222 | default: | 1237 | default: |
1223 | rc = -ENOPROTOOPT; | 1238 | rc = -ENOPROTOOPT; |
1224 | break; | 1239 | break; |
@@ -1250,6 +1265,12 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname, | |||
1250 | case SO_IPRMDATA_MSG: | 1265 | case SO_IPRMDATA_MSG: |
1251 | val = (iucv->flags & IUCV_IPRMDATA) ? 1 : 0; | 1266 | val = (iucv->flags & IUCV_IPRMDATA) ? 1 : 0; |
1252 | break; | 1267 | break; |
1268 | case SO_MSGLIMIT: | ||
1269 | lock_sock(sk); | ||
1270 | val = (iucv->path != NULL) ? iucv->path->msglim /* connected */ | ||
1271 | : iucv->msglimit; /* default */ | ||
1272 | release_sock(sk); | ||
1273 | break; | ||
1253 | default: | 1274 | default: |
1254 | return -ENOPROTOOPT; | 1275 | return -ENOPROTOOPT; |
1255 | } | 1276 | } |
@@ -1339,7 +1360,9 @@ static int iucv_callback_connreq(struct iucv_path *path, | |||
1339 | memcpy(nuser_data + 8, niucv->src_name, 8); | 1360 | memcpy(nuser_data + 8, niucv->src_name, 8); |
1340 | ASCEBC(nuser_data + 8, 8); | 1361 | ASCEBC(nuser_data + 8, 8); |
1341 | 1362 | ||
1342 | path->msglim = IUCV_QUEUELEN_DEFAULT; | 1363 | /* set message limit for path based on msglimit of accepting socket */ |
1364 | niucv->msglimit = iucv->msglimit; | ||
1365 | path->msglim = iucv->msglimit; | ||
1343 | err = iucv_path_accept(path, &af_iucv_handler, nuser_data, nsk); | 1366 | err = iucv_path_accept(path, &af_iucv_handler, nuser_data, nsk); |
1344 | if (err) { | 1367 | if (err) { |
1345 | err = iucv_path_sever(path, user_data); | 1368 | err = iucv_path_sever(path, user_data); |