aboutsummaryrefslogtreecommitdiff
path: root/net/sctp/bind_addr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-07 10:59:48 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-07 10:59:48 -0800
commit29ac0052ea454871273a1fc7ef09a97f3c214ee6 (patch)
tree40441a8ec1f34b508ae1cc4bb91f9fabad4889e9 /net/sctp/bind_addr.c
parentf3656b9a2740ebdff123b30b6b806648c9f189f8 (diff)
parent4aa9cb320e8081fbaec0c10eb0e077c8ca4d1ad9 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [AF_RXRPC]: Add a missing goto [VLAN]: Lost rtnl_unlock() in vlan_ioctl() [SCTP]: Fix the bind_addr info during migration. [SCTP]: Add bind hash locking to the migrate code [IPV4]: Remove prototype of ip_rt_advice [IPv4]: Reply net unreachable ICMP message [IPv6] SNMP: Increment OutNoRoutes when connecting to unreachable network [BRIDGE]: Section fix. [NIU]: Fix link LED handling.
Diffstat (limited to 'net/sctp/bind_addr.c')
-rw-r--r--net/sctp/bind_addr.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index cae95af9a8c..6a7d01091f0 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.
*/