]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sctp/bind_addr.c
[NETPOLL]: Remove CONFIG_NETPOLL_RX
[linux-2.6-omap-h63xx.git] / net / sctp / bind_addr.c
index 2b962627f631390ebe3af403b7915d27080d8808..fdb287a9e2e2c8c9b3baa97ca1ee11f8b59093eb 100644 (file)
@@ -43,7 +43,6 @@
  */
 
 #include <linux/types.h>
-#include <linux/sched.h>
 #include <linux/in.h>
 #include <net/sock.h>
 #include <net/ipv6.h>
@@ -62,7 +61,7 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *);
 /* Copy 'src' to 'dest' taking 'scope' into account.  Omit addresses
  * in 'src' which have a broader scope than 'scope'.
  */
-int sctp_bind_addr_copy(struct sctp_bind_addr *dest, 
+int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
                        const struct sctp_bind_addr *src,
                        sctp_scope_t scope, gfp_t gfp,
                        int flags)
@@ -146,7 +145,7 @@ void sctp_bind_addr_free(struct sctp_bind_addr *bp)
 
 /* Add an address to the bind address list in the SCTP_bind_addr structure. */
 int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
-                      gfp_t gfp)
+                      __u8 use_as_src, gfp_t gfp)
 {
        struct sctp_sockaddr_entry *addr;
 
@@ -161,7 +160,9 @@ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
         * Both v4 and v6 have the port at the same offset.
         */
        if (!addr->a.v4.sin_port)
-               addr->a.v4.sin_port = bp->port;
+               addr->a.v4.sin_port = htons(bp->port);
+
+       addr->use_as_src = use_as_src;
 
        INIT_LIST_HEAD(&addr->list);
        list_add_tail(&addr->list, &bp->address_list);
@@ -273,8 +274,8 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
                        break;
                }
 
-               af->from_addr_param(&addr, rawaddr, port, 0);
-               retval = sctp_add_bind_addr(bp, &addr, gfp);
+               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. */
                        sctp_bind_addr_clean(bp);
@@ -294,7 +295,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
  ********************************************************************/
 
 /* Does this contain a specified address?  Allow wildcarding. */
-int sctp_bind_addr_match(struct sctp_bind_addr *bp, 
+int sctp_bind_addr_match(struct sctp_bind_addr *bp,
                         const union sctp_addr *addr,
                         struct sctp_sock *opt)
 {
@@ -304,7 +305,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, addr, opt))
-                       return 1;
+                       return 1;
        }
 
        return 0;
@@ -327,12 +328,12 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr     *bp,
 
        list_for_each(pos, &bp->address_list) {
                laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
-               
+
                addr_buf = (union sctp_addr *)addrs;
                for (i = 0; i < addrcnt; i++) {
                        addr = (union sctp_addr *)addr_buf;
                        af = sctp_get_af_specific(addr->v4.sin_family);
-                       if (!af) 
+                       if (!af)
                                return NULL;
 
                        if (opt->pf->cmp_addr(&laddr->a, addr, opt))
@@ -348,7 +349,7 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr       *bp,
 }
 
 /* Copy out addresses from the global local address list. */
-static int sctp_copy_one_addr(struct sctp_bind_addr *dest, 
+static int sctp_copy_one_addr(struct sctp_bind_addr *dest,
                              union sctp_addr *addr,
                              sctp_scope_t scope, gfp_t gfp,
                              int flags)
@@ -367,7 +368,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, gfp);
+                       error = sctp_add_bind_addr(dest, addr, 1, gfp);
        }
 
        return error;