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 /include/net/sctp | |
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 'include/net/sctp')
-rw-r--r-- | include/net/sctp/sctp.h | 6 | ||||
-rw-r--r-- | include/net/sctp/structs.h | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 87b119f74c4a..640915a0613d 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -156,7 +156,7 @@ void sctp_hash_established(struct sctp_association *); | |||
156 | void sctp_unhash_established(struct sctp_association *); | 156 | void sctp_unhash_established(struct sctp_association *); |
157 | void sctp_hash_endpoint(struct sctp_endpoint *); | 157 | void sctp_hash_endpoint(struct sctp_endpoint *); |
158 | void sctp_unhash_endpoint(struct sctp_endpoint *); | 158 | void sctp_unhash_endpoint(struct sctp_endpoint *); |
159 | struct sock *sctp_err_lookup(int family, struct sk_buff *, | 159 | struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *, |
160 | struct sctphdr *, struct sctp_association **, | 160 | struct sctphdr *, struct sctp_association **, |
161 | struct sctp_transport **); | 161 | struct sctp_transport **); |
162 | void sctp_err_finish(struct sock *, struct sctp_association *); | 162 | void sctp_err_finish(struct sock *, struct sctp_association *); |
@@ -644,9 +644,9 @@ static inline int sctp_ep_hashfn(struct net *net, __u16 lport) | |||
644 | } | 644 | } |
645 | 645 | ||
646 | /* This is the hash function for the association hash table. */ | 646 | /* This is the hash function for the association hash table. */ |
647 | static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) | 647 | static inline int sctp_assoc_hashfn(struct net *net, __u16 lport, __u16 rport) |
648 | { | 648 | { |
649 | int h = (lport << 16) + rport; | 649 | int h = (lport << 16) + rport + net_hash_mix(net); |
650 | h ^= h>>8; | 650 | h ^= h>>8; |
651 | return h & (sctp_assoc_hashsize - 1); | 651 | return h & (sctp_assoc_hashsize - 1); |
652 | } | 652 | } |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 9f9de558541f..c0563d1dd7c7 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -1427,7 +1427,7 @@ int sctp_endpoint_is_peeled_off(struct sctp_endpoint *, | |||
1427 | const union sctp_addr *); | 1427 | const union sctp_addr *); |
1428 | struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *, | 1428 | struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *, |
1429 | struct net *, const union sctp_addr *); | 1429 | struct net *, const union sctp_addr *); |
1430 | int sctp_has_association(const union sctp_addr *laddr, | 1430 | int sctp_has_association(struct net *net, const union sctp_addr *laddr, |
1431 | const union sctp_addr *paddr); | 1431 | const union sctp_addr *paddr); |
1432 | 1432 | ||
1433 | int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, | 1433 | int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, |
@@ -2014,6 +2014,7 @@ void sctp_assoc_control_transport(struct sctp_association *, | |||
2014 | sctp_transport_cmd_t, sctp_sn_error_t); | 2014 | sctp_transport_cmd_t, sctp_sn_error_t); |
2015 | struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32); | 2015 | struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32); |
2016 | struct sctp_transport *sctp_assoc_is_match(struct sctp_association *, | 2016 | struct sctp_transport *sctp_assoc_is_match(struct sctp_association *, |
2017 | struct net *, | ||
2017 | const union sctp_addr *, | 2018 | const union sctp_addr *, |
2018 | const union sctp_addr *); | 2019 | const union sctp_addr *); |
2019 | void sctp_assoc_migrate(struct sctp_association *, struct sock *); | 2020 | void sctp_assoc_migrate(struct sctp_association *, struct sock *); |