X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fsctp%2Fbind_addr.c;h=00994158e4962997ba90a6ac9cdf7a00863bf9ea;hb=refs%2Fheads%2Fvserver;hp=b484b4afd7301eded651f956d194d0dded4fe38a;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index b484b4afd..00994158e 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c @@ -53,7 +53,8 @@ /* Forward declarations for internal helpers. */ static int sctp_copy_one_addr(struct sctp_bind_addr *, union sctp_addr *, - sctp_scope_t scope, int gfp, int flags); + sctp_scope_t scope, gfp_t gfp, + int flags); static void sctp_bind_addr_clean(struct sctp_bind_addr *); /* First Level Abstractions. */ @@ -63,7 +64,8 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *); */ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, const struct sctp_bind_addr *src, - sctp_scope_t scope, int gfp, int flags) + sctp_scope_t scope, gfp_t gfp, + int flags) { struct sctp_sockaddr_entry *addr; struct list_head *pos; @@ -104,23 +106,6 @@ out: return error; } -/* Create a new SCTP_bind_addr from nothing. */ -struct sctp_bind_addr *sctp_bind_addr_new(int gfp) -{ - struct sctp_bind_addr *retval; - - retval = t_new(struct sctp_bind_addr, gfp); - if (!retval) - goto nomem; - - sctp_bind_addr_init(retval, 0); - retval->malloced = 1; - SCTP_DBG_OBJCNT_INC(bind_addr); - -nomem: - return retval; -} - /* Initialize the SCTP_bind_addr structure for either an endpoint or * an association. */ @@ -161,7 +146,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, - int gfp) + __u8 use_as_src, gfp_t gfp) { struct sctp_sockaddr_entry *addr; @@ -176,7 +161,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); @@ -214,7 +201,8 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr) * The second argument is the return value for the length. */ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, - int *addrs_len, int gfp) + int *addrs_len, + gfp_t gfp) { union sctp_params addrparms; union sctp_params retval; @@ -266,7 +254,7 @@ end_raw: * address parameters). */ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, - int addrs_len, __u16 port, int gfp) + int addrs_len, __u16 port, gfp_t gfp) { union sctp_addr_param *rawaddr; struct sctp_paramhdr *param; @@ -287,8 +275,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); @@ -310,7 +298,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, const union sctp_addr *addr, - struct sctp_opt *opt) + struct sctp_sock *opt) { struct sctp_sockaddr_entry *laddr; struct list_head *pos; @@ -330,7 +318,7 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp, union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, const union sctp_addr *addrs, int addrcnt, - struct sctp_opt *opt) + struct sctp_sock *opt) { struct sctp_sockaddr_entry *laddr; union sctp_addr *addr; @@ -364,7 +352,8 @@ 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, union sctp_addr *addr, - sctp_scope_t scope, int gfp, int flags) + sctp_scope_t scope, gfp_t gfp, + int flags) { int error = 0; @@ -380,7 +369,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;