diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-20 17:10:38 -0800 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-02 21:26:47 -0800 |
commit | 5ab7b859ab58e3479a5a66e383ecd6bc447f6c1d (patch) | |
tree | f876ff7c51eb7d5a2d3fdb8dcb97b6b19d79dde7 /net/sctp/bind_addr.c | |
parent | 4bdf4b5fe22c26750c39fdd2939a5f33df0cc341 (diff) | |
download | kernel_goldelico_gta04-5ab7b859ab58e3479a5a66e383ecd6bc447f6c1d.zip kernel_goldelico_gta04-5ab7b859ab58e3479a5a66e383ecd6bc447f6c1d.tar.gz kernel_goldelico_gta04-5ab7b859ab58e3479a5a66e383ecd6bc447f6c1d.tar.bz2 |
[SCTP]: Switch sctp_add_bind_addr() to net-endian.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/bind_addr.c')
-rw-r--r-- | net/sctp/bind_addr.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index eafdd11..eb3a5e2 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c @@ -155,15 +155,15 @@ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new, if (!addr) return -ENOMEM; - memcpy(&addr->a_h, new, sizeof(*new)); + memcpy(&addr->a, new, sizeof(*new)); /* Fix up the port if it has not yet been set. * Both v4 and v6 have the port at the same offset. */ - if (!addr->a_h.v4.sin_port) - addr->a_h.v4.sin_port = bp->port; + if (!addr->a.v4.sin_port) + addr->a.v4.sin_port = htons(bp->port); - flip_to_n(&addr->a, &addr->a_h); + flip_to_h(&addr->a_h, &addr->a); addr->use_as_src = use_as_src; @@ -264,6 +264,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, int retval = 0; int len; struct sctp_af *af; + union sctp_addr tmp; /* Convert the raw address to standard address format */ while (addrs_len) { @@ -278,7 +279,8 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, } af->from_addr_param(&addr, rawaddr, port, 0); - retval = sctp_add_bind_addr(bp, &addr, 1, gfp); + flip_to_n(&tmp, &addr); + retval = sctp_add_bind_addr(bp, &tmp, 1, gfp); if (retval) { /* Can't finish building the list, clean up. */ sctp_bind_addr_clean(bp); @@ -358,6 +360,8 @@ static int sctp_copy_one_addr(struct sctp_bind_addr *dest, int flags) { int error = 0; + union sctp_addr tmp; + flip_to_n(&tmp, addr); if (sctp_is_any(addr)) { error = sctp_copy_local_addr_list(dest, scope, gfp, flags); @@ -371,7 +375,7 @@ static int sctp_copy_one_addr(struct sctp_bind_addr *dest, (((AF_INET6 == addr->sa.sa_family) && (flags & SCTP_ADDR6_ALLOWED) && (flags & SCTP_ADDR6_PEERSUPP)))) - error = sctp_add_bind_addr(dest, addr, 1, gfp); + error = sctp_add_bind_addr(dest, &tmp, 1, gfp); } return error; |