diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-09-18 03:19:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-09-18 03:19:32 -0400 |
commit | 88f964db6ef728982734356bf4c406270ea29c1d (patch) | |
tree | 7fb9ba2fb646f4917911fed4a0a37cd52a12eae4 /net/dccp/proto.c | |
parent | 561713cf475de1f671cc89c437927ec008a20209 (diff) |
[DCCP]: Introduce CCID getsockopt for the CCIDs
Allocation for the optnames is similar to the DCCP options, with a
range for rx and tx half connection CCIDs.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/proto.c')
-rw-r--r-- | net/dccp/proto.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 9bda2868eba6..a1cfd0e9e3bc 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -325,12 +325,7 @@ int dccp_getsockopt(struct sock *sk, int level, int optname, | |||
325 | if (get_user(len, optlen)) | 325 | if (get_user(len, optlen)) |
326 | return -EFAULT; | 326 | return -EFAULT; |
327 | 327 | ||
328 | if (optname == DCCP_SOCKOPT_SERVICE) | 328 | if (len < sizeof(int)) |
329 | return dccp_getsockopt_service(sk, len, | ||
330 | (u32 __user *)optval, optlen); | ||
331 | |||
332 | len = min_t(unsigned int, len, sizeof(int)); | ||
333 | if (len < 0) | ||
334 | return -EINVAL; | 329 | return -EINVAL; |
335 | 330 | ||
336 | dp = dccp_sk(sk); | 331 | dp = dccp_sk(sk); |
@@ -338,7 +333,17 @@ int dccp_getsockopt(struct sock *sk, int level, int optname, | |||
338 | switch (optname) { | 333 | switch (optname) { |
339 | case DCCP_SOCKOPT_PACKET_SIZE: | 334 | case DCCP_SOCKOPT_PACKET_SIZE: |
340 | val = dp->dccps_packet_size; | 335 | val = dp->dccps_packet_size; |
336 | len = sizeof(dp->dccps_packet_size); | ||
341 | break; | 337 | break; |
338 | case DCCP_SOCKOPT_SERVICE: | ||
339 | return dccp_getsockopt_service(sk, len, | ||
340 | (u32 __user *)optval, optlen); | ||
341 | case 128 ... 191: | ||
342 | return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname, | ||
343 | len, (u32 __user *)optval, optlen); | ||
344 | case 192 ... 255: | ||
345 | return ccid_hc_tx_getsockopt(dp->dccps_hc_tx_ccid, sk, optname, | ||
346 | len, (u32 __user *)optval, optlen); | ||
342 | default: | 347 | default: |
343 | return -ENOPROTOOPT; | 348 | return -ENOPROTOOPT; |
344 | } | 349 | } |