diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-08-06 04:41:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-15 01:44:12 -0400 |
commit | 4110cc255ddec59c79fba4d71cdd948d0a382140 (patch) | |
tree | 53fc9c7cd7e41f547d94469f9268fde2a5404616 /net/sctp/endpointola.c | |
parent | 4cdadcbcb64bdf3ae8bdf3ef5bb2b91c85444cfa (diff) |
sctp: Make the association hashtable handle multiple network namespaces
- Use struct net in the hash calculation
- Use sock_net(association.base.sk) in the association lookups.
- On receive calculate the network namespace from skb->dev.
- Pass struct net from receive down to the functions that actually
do the association lookup.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/endpointola.c')
-rw-r--r-- | net/sctp/endpointola.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 50c87b4ad765..6b763939345b 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
@@ -345,7 +345,8 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc( | |||
345 | 345 | ||
346 | rport = ntohs(paddr->v4.sin_port); | 346 | rport = ntohs(paddr->v4.sin_port); |
347 | 347 | ||
348 | hash = sctp_assoc_hashfn(ep->base.bind_addr.port, rport); | 348 | hash = sctp_assoc_hashfn(sock_net(ep->base.sk), ep->base.bind_addr.port, |
349 | rport); | ||
349 | head = &sctp_assoc_hashtable[hash]; | 350 | head = &sctp_assoc_hashtable[hash]; |
350 | read_lock(&head->lock); | 351 | read_lock(&head->lock); |
351 | sctp_for_each_hentry(epb, node, &head->chain) { | 352 | sctp_for_each_hentry(epb, node, &head->chain) { |
@@ -388,13 +389,14 @@ int sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep, | |||
388 | { | 389 | { |
389 | struct sctp_sockaddr_entry *addr; | 390 | struct sctp_sockaddr_entry *addr; |
390 | struct sctp_bind_addr *bp; | 391 | struct sctp_bind_addr *bp; |
392 | struct net *net = sock_net(ep->base.sk); | ||
391 | 393 | ||
392 | bp = &ep->base.bind_addr; | 394 | bp = &ep->base.bind_addr; |
393 | /* This function is called with the socket lock held, | 395 | /* This function is called with the socket lock held, |
394 | * so the address_list can not change. | 396 | * so the address_list can not change. |
395 | */ | 397 | */ |
396 | list_for_each_entry(addr, &bp->address_list, list) { | 398 | list_for_each_entry(addr, &bp->address_list, list) { |
397 | if (sctp_has_association(&addr->a, paddr)) | 399 | if (sctp_has_association(net, &addr->a, paddr)) |
398 | return 1; | 400 | return 1; |
399 | } | 401 | } |
400 | 402 | ||