Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 168736
b: refs/heads/master
c: f9c6781
h: refs/heads/master
v: v3
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed Nov 14, 2009
1 parent 00df045 commit 039996e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 409b95aff3583c05ac7a9247fa3d8c9aa7f9cae3
refs/heads/master: f9c67811ebc00a42f62f5d542d3abd36bd49ae35
18 changes: 13 additions & 5 deletions trunk/net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1276,22 +1276,30 @@ SCTP_STATIC int sctp_setsockopt_connectx(struct sock* sk,
}

/*
* New (hopefully final) interface for the API. The option buffer is used
* both for the returned association id and the addresses.
* New (hopefully final) interface for the API.
* We use the sctp_getaddrs_old structure so that use-space library
* can avoid any unnecessary allocations. The only defferent part
* is that we store the actual length of the address buffer into the
* addrs_num structure member. That way we can re-use the existing
* code.
*/
SCTP_STATIC int sctp_getsockopt_connectx3(struct sock* sk, int len,
char __user *optval,
int __user *optlen)
{
struct sctp_getaddrs_old param;
sctp_assoc_t assoc_id = 0;
int err = 0;

if (len < sizeof(assoc_id))
if (len < sizeof(param))
return -EINVAL;

if (copy_from_user(&param, optval, sizeof(param)))
return -EFAULT;

err = __sctp_setsockopt_connectx(sk,
(struct sockaddr __user *)(optval + sizeof(assoc_id)),
len - sizeof(assoc_id), &assoc_id);
(struct sockaddr __user *)param.addrs,
param.addr_num, &assoc_id);

if (err == 0 || err == -EINPROGRESS) {
if (copy_to_user(optval, &assoc_id, sizeof(assoc_id)))
Expand Down

0 comments on commit 039996e

Please sign in to comment.