aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/bind_addr.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 20:10:38 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:26:47 -0500
commit5ab7b859ab58e3479a5a66e383ecd6bc447f6c1d (patch)
treef876ff7c51eb7d5a2d3fdb8dcb97b6b19d79dde7 /net/sctp/bind_addr.c
parent4bdf4b5fe22c26750c39fdd2939a5f33df0cc341 (diff)
[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.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index eafdd11152d0..eb3a5e25777d 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,
155 if (!addr) 155 if (!addr)
156 return -ENOMEM; 156 return -ENOMEM;
157 157
158 memcpy(&addr->a_h, new, sizeof(*new)); 158 memcpy(&addr->a, new, sizeof(*new));
159 159
160 /* Fix up the port if it has not yet been set. 160 /* Fix up the port if it has not yet been set.
161 * Both v4 and v6 have the port at the same offset. 161 * Both v4 and v6 have the port at the same offset.
162 */ 162 */
163 if (!addr->a_h.v4.sin_port) 163 if (!addr->a.v4.sin_port)
164 addr->a_h.v4.sin_port = bp->port; 164 addr->a.v4.sin_port = htons(bp->port);
165 165
166 flip_to_n(&addr->a, &addr->a_h); 166 flip_to_h(&addr->a_h, &addr->a);
167 167
168 addr->use_as_src = use_as_src; 168 addr->use_as_src = use_as_src;
169 169
@@ -264,6 +264,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
264 int retval = 0; 264 int retval = 0;
265 int len; 265 int len;
266 struct sctp_af *af; 266 struct sctp_af *af;
267 union sctp_addr tmp;
267 268
268 /* Convert the raw address to standard address format */ 269 /* Convert the raw address to standard address format */
269 while (addrs_len) { 270 while (addrs_len) {
@@ -278,7 +279,8 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
278 } 279 }
279 280
280 af->from_addr_param(&addr, rawaddr, port, 0); 281 af->from_addr_param(&addr, rawaddr, port, 0);
281 retval = sctp_add_bind_addr(bp, &addr, 1, gfp); 282 flip_to_n(&tmp, &addr);
283 retval = sctp_add_bind_addr(bp, &tmp, 1, gfp);
282 if (retval) { 284 if (retval) {
283 /* Can't finish building the list, clean up. */ 285 /* Can't finish building the list, clean up. */
284 sctp_bind_addr_clean(bp); 286 sctp_bind_addr_clean(bp);
@@ -358,6 +360,8 @@ static int sctp_copy_one_addr(struct sctp_bind_addr *dest,
358 int flags) 360 int flags)
359{ 361{
360 int error = 0; 362 int error = 0;
363 union sctp_addr tmp;
364 flip_to_n(&tmp, addr);
361 365
362 if (sctp_is_any(addr)) { 366 if (sctp_is_any(addr)) {
363 error = sctp_copy_local_addr_list(dest, scope, gfp, flags); 367 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,
371 (((AF_INET6 == addr->sa.sa_family) && 375 (((AF_INET6 == addr->sa.sa_family) &&
372 (flags & SCTP_ADDR6_ALLOWED) && 376 (flags & SCTP_ADDR6_ALLOWED) &&
373 (flags & SCTP_ADDR6_PEERSUPP)))) 377 (flags & SCTP_ADDR6_PEERSUPP))))
374 error = sctp_add_bind_addr(dest, addr, 1, gfp); 378 error = sctp_add_bind_addr(dest, &tmp, 1, gfp);
375 } 379 }
376 380
377 return error; 381 return error;