Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@kernel.bkbits.net>2004-02-13 06:13:57 -0800
committerDavid S. Miller <davem@kernel.bkbits.net>2004-02-13 06:13:57 -0800
commitc54c4df5211e0c106cca06f4b74faf8024a63e4c (patch)
tree948abd1edc3cc08ec029a45d7791478e06e13f4b
parentd1c0dfc84a8d1a97db4bf3fc5f67c0fa6e6cd5ec (diff)
parent307be3f0fe50430a0166b35d5cf33ee967f95d50 (diff)
Merge davem@nuts.davemloft.net:/disk1/BK/sctp-2.6
into kernel.bkbits.net:/home/davem/sctp-2.6
-rw-r--r--net/sctp/socket.c17
-rw-r--r--net/sctp/ssnmap.c10
2 files changed, 23 insertions, 4 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 4f7cbfe0e36c..8062d2a984af 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1683,10 +1683,23 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk,
*/
static int sctp_setsockopt_initmsg(struct sock *sk, char *optval, int optlen)
{
+ struct sctp_initmsg sinit;
+ struct sctp_opt *sp = sctp_sk(sk);
+
if (optlen != sizeof(struct sctp_initmsg))
return -EINVAL;
- if (copy_from_user(&sctp_sk(sk)->initmsg, optval, optlen))
+ if (copy_from_user(&sinit, optval, optlen))
return -EFAULT;
+
+ if (sinit.sinit_num_ostreams)
+ sp->initmsg.sinit_num_ostreams = sinit.sinit_num_ostreams;
+ if (sinit.sinit_max_instreams)
+ sp->initmsg.sinit_max_instreams = sinit.sinit_max_instreams;
+ if (sinit.sinit_max_attempts)
+ sp->initmsg.sinit_max_attempts = sinit.sinit_max_attempts;
+ if (sinit.sinit_max_init_timeo)
+ sp->initmsg.sinit_max_init_timeo = sinit.sinit_max_init_timeo;
+
return 0;
}
@@ -2880,6 +2893,7 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
memcpy(&temp, &from->ipaddr, sizeof(temp));
sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len;
+ temp.v4.sin_port = htons(temp.v4.sin_port);
if (copy_to_user(to, &temp, addrlen))
return -EFAULT;
to += addrlen ;
@@ -2974,6 +2988,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
memcpy(&temp, &from->a, sizeof(temp));
sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
+ temp.v4.sin_port = htons(temp.v4.sin_port);
if (copy_to_user(to, &temp, addrlen))
return -EFAULT;
to += addrlen;
diff --git a/net/sctp/ssnmap.c b/net/sctp/ssnmap.c
index 345ab7120e8d..f907f9a8c31a 100644
--- a/net/sctp/ssnmap.c
+++ b/net/sctp/ssnmap.c
@@ -56,8 +56,10 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
{
struct sctp_ssnmap *retval;
+ int order;
- retval = kmalloc(sctp_ssnmap_size(in, out), gfp);
+ order = get_order(sctp_ssnmap_size(in,out));
+ retval = (struct sctp_ssnmap *)__get_free_pages(gfp, order);
if (!retval)
goto fail;
@@ -71,7 +73,7 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
return retval;
fail_map:
- kfree(retval);
+ free_pages((unsigned long)retval, order);
fail:
return NULL;
}
@@ -107,7 +109,9 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map)
void sctp_ssnmap_free(struct sctp_ssnmap *map)
{
if (map && map->malloced) {
- kfree(map);
+ free_pages((unsigned long)map,
+ get_order(sctp_ssnmap_size(map->in.len,
+ map->out.len)));
SCTP_DBG_OBJCNT_DEC(ssnmap);
}
}