aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/bind_addr.c
diff options
context:
space:
mode:
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 cae95af9a8cc..6a7d01091f0c 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -105,6 +105,32 @@ out:
105 return error; 105 return error;
106} 106}
107 107
108/* Exactly duplicate the address lists. This is necessary when doing
109 * peer-offs and accepts. We don't want to put all the current system
110 * addresses into the endpoint. That's useless. But we do want duplicat
111 * the list of bound addresses that the older endpoint used.
112 */
113int sctp_bind_addr_dup(struct sctp_bind_addr *dest,
114 const struct sctp_bind_addr *src,
115 gfp_t gfp)
116{
117 struct sctp_sockaddr_entry *addr;
118 struct list_head *pos;
119 int error = 0;
120
121 /* All addresses share the same port. */
122 dest->port = src->port;
123
124 list_for_each(pos, &src->address_list) {
125 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
126 error = sctp_add_bind_addr(dest, &addr->a, 1, gfp);
127 if (error < 0)
128 break;
129 }
130
131 return error;
132}
133
108/* Initialize the SCTP_bind_addr structure for either an endpoint or 134/* Initialize the SCTP_bind_addr structure for either an endpoint or
109 * an association. 135 * an association.
110 */ 136 */