]> err.no Git - linux-2.6/blobdiff - net/sctp/bind_addr.c
[SCTP]: sctp_copy_one_addr() switched to net-endian.
[linux-2.6] / net / sctp / bind_addr.c
index b8115cb31ae330abfc78397559e7dd1322f98648..50f3697625fda943909e79df63d0e7a25cb02b01 100644 (file)
@@ -77,7 +77,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
        /* Extract the addresses which are relevant for this scope.  */
        list_for_each(pos, &src->address_list) {
                addr = list_entry(pos, struct sctp_sockaddr_entry, list);
-               error = sctp_copy_one_addr(dest, &addr->a_h, scope,
+               error = sctp_copy_one_addr(dest, &addr->a, scope,
                                           gfp, flags);
                if (error < 0)
                        goto out;
@@ -91,7 +91,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
                list_for_each(pos, &src->address_list) {
                        addr = list_entry(pos, struct sctp_sockaddr_entry,
                                          list);
-                       error = sctp_copy_one_addr(dest, &addr->a_h,
+                       error = sctp_copy_one_addr(dest, &addr->a,
                                                   SCTP_SCOPE_LINK, gfp,
                                                   flags);
                        if (error < 0)
@@ -155,13 +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_h(&addr->a_h, &addr->a);
 
        addr->use_as_src = use_as_src;
 
@@ -182,7 +184,7 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
 
        list_for_each_safe(pos, temp, &bp->address_list) {
                addr = list_entry(pos, struct sctp_sockaddr_entry, list);
-               if (sctp_cmp_addr_exact(&addr->a_h, del_addr)) {
+               if (sctp_cmp_addr_exact(&addr->a, del_addr)) {
                        /* Found the exact match. */
                        list_del(pos);
                        kfree(addr);
@@ -275,7 +277,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
                        break;
                }
 
-               af->from_addr_param(&addr, rawaddr, port, 0);
+               af->from_addr_param(&addr, rawaddr, htons(port), 0);
                retval = sctp_add_bind_addr(bp, &addr, 1, gfp);
                if (retval) {
                        /* Can't finish building the list, clean up. */
@@ -305,7 +307,7 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp,
 
        list_for_each(pos, &bp->address_list) {
                laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
-               if (opt->pf->cmp_addr(&laddr->a_h, addr, opt))
+               if (opt->pf->cmp_addr(&laddr->a, addr, opt))
                        return 1;
        }
 
@@ -332,14 +334,12 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr     *bp,
                
                addr_buf = (union sctp_addr *)addrs;
                for (i = 0; i < addrcnt; i++) {
-                       union sctp_addr tmp;
                        addr = (union sctp_addr *)addr_buf;
                        af = sctp_get_af_specific(addr->v4.sin_family);
                        if (!af) 
                                return NULL;
-                       flip_to_h(&tmp, addr);
 
-                       if (opt->pf->cmp_addr(&laddr->a_h, &tmp, opt))
+                       if (opt->pf->cmp_addr(&laddr->a, addr, opt))
                                break;
 
                        addr_buf += af->sockaddr_len;