Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74692
b: refs/heads/master
c: 8e71a11
h: refs/heads/master
v: v3
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed Dec 7, 2007
1 parent f273786 commit 0f77ab1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f26f7c480555812ca7c4037e0a50fa54afe2cb4a
refs/heads/master: 8e71a11c9f3c09a01fcb445772ffd61b140f2479
3 changes: 3 additions & 0 deletions trunk/include/net/sctp/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,9 @@ 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);
int sctp_bind_addr_dup(struct sctp_bind_addr *dest,
const struct sctp_bind_addr *src,
gfp_t gfp);
int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
__u8 use_as_src, gfp_t gfp);
int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
Expand Down
26 changes: 26 additions & 0 deletions trunk/net/sctp/bind_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,32 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
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.
*/
Expand Down
12 changes: 2 additions & 10 deletions trunk/net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -6326,7 +6326,6 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
struct sk_buff *skb, *tmp;
struct sctp_ulpevent *event;
struct sctp_bind_hashbucket *head;
int flags = 0;

/* Migrate socket buffer sizes and all the socket level options to the
* new socket.
Expand Down Expand Up @@ -6356,15 +6355,8 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
/* Copy the bind_addr list from the original endpoint to the new
* endpoint so that we can handle restarts properly
*/
if (PF_INET6 == assoc->base.sk->sk_family)
flags = SCTP_ADDR6_ALLOWED;
if (assoc->peer.ipv4_address)
flags |= SCTP_ADDR4_PEERSUPP;
if (assoc->peer.ipv6_address)
flags |= SCTP_ADDR6_PEERSUPP;
sctp_bind_addr_copy(&newsp->ep->base.bind_addr,
&oldsp->ep->base.bind_addr,
SCTP_SCOPE_GLOBAL, GFP_KERNEL, flags);
sctp_bind_addr_dup(&newsp->ep->base.bind_addr,
&oldsp->ep->base.bind_addr, GFP_KERNEL);

/* Move any messages in the old socket's receive queue that are for the
* peeled off association to the new socket's receive queue.
Expand Down

0 comments on commit 0f77ab1

Please sign in to comment.