diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2007-12-06 22:50:54 -0800 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-12-07 01:07:49 -0800 |
commit | 8e71a11c9f3c09a01fcb445772ffd61b140f2479 (patch) | |
tree | a0fb2c002d472252ea060c88f8dfda6ddb23b3fc /net/sctp/bind_addr.c | |
parent | f26f7c480555812ca7c4037e0a50fa54afe2cb4a (diff) | |
download | blackbird-op-linux-8e71a11c9f3c09a01fcb445772ffd61b140f2479.tar.gz blackbird-op-linux-8e71a11c9f3c09a01fcb445772ffd61b140f2479.zip |
[SCTP]: Fix the bind_addr info during migration.
During accept/migrate the code attempts to copy the addresses from
the parent endpoint to the new endpoint. However, if the parent
was bound to a wildcard address, then we end up pointlessly copying
all of the current addresses on the system.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
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 | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index cae95af9a8cc..6a7d01091f0c 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c @@ -105,6 +105,32 @@ out: return error; } +/* Exactly duplicate the address lists. This is necessary when doing + * peer-offs and accepts. We don't want to put all the current system + * addresses into the endpoint. That's useless. But we do want duplicat + * the list of bound addresses that the older endpoint used. + */ +int sctp_bind_addr_dup(struct sctp_bind_addr *dest, + const struct sctp_bind_addr *src, + gfp_t gfp) +{ + struct sctp_sockaddr_entry *addr; + struct list_head *pos; + int error = 0; + + /* All addresses share the same port. */ + dest->port = src->port; + + list_for_each(pos, &src->address_list) { + addr = list_entry(pos, struct sctp_sockaddr_entry, list); + error = sctp_add_bind_addr(dest, &addr->a, 1, gfp); + if (error < 0) + break; + } + + return error; +} + /* Initialize the SCTP_bind_addr structure for either an endpoint or * an association. */ |