diff options
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r-- | net/sctp/associola.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index ebaef3ed6065..b1ef3bc301a5 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -82,6 +82,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
82 | sctp_scope_t scope, | 82 | sctp_scope_t scope, |
83 | gfp_t gfp) | 83 | gfp_t gfp) |
84 | { | 84 | { |
85 | struct net *net = sock_net(sk); | ||
85 | struct sctp_sock *sp; | 86 | struct sctp_sock *sp; |
86 | int i; | 87 | int i; |
87 | sctp_paramhdr_t *p; | 88 | sctp_paramhdr_t *p; |
@@ -124,7 +125,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
124 | * socket values. | 125 | * socket values. |
125 | */ | 126 | */ |
126 | asoc->max_retrans = sp->assocparams.sasoc_asocmaxrxt; | 127 | asoc->max_retrans = sp->assocparams.sasoc_asocmaxrxt; |
127 | asoc->pf_retrans = sctp_pf_retrans; | 128 | asoc->pf_retrans = net->sctp.pf_retrans; |
128 | 129 | ||
129 | asoc->rto_initial = msecs_to_jiffies(sp->rtoinfo.srto_initial); | 130 | asoc->rto_initial = msecs_to_jiffies(sp->rtoinfo.srto_initial); |
130 | asoc->rto_max = msecs_to_jiffies(sp->rtoinfo.srto_max); | 131 | asoc->rto_max = msecs_to_jiffies(sp->rtoinfo.srto_max); |
@@ -175,7 +176,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
175 | asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; | 176 | asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; |
176 | asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; | 177 | asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; |
177 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = | 178 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = |
178 | min_t(unsigned long, sp->autoclose, sctp_max_autoclose) * HZ; | 179 | min_t(unsigned long, sp->autoclose, net->sctp.max_autoclose) * HZ; |
179 | 180 | ||
180 | /* Initializes the timers */ | 181 | /* Initializes the timers */ |
181 | for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) | 182 | for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) |
@@ -281,7 +282,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
281 | * and will revert old behavior. | 282 | * and will revert old behavior. |
282 | */ | 283 | */ |
283 | asoc->peer.asconf_capable = 0; | 284 | asoc->peer.asconf_capable = 0; |
284 | if (sctp_addip_noauth) | 285 | if (net->sctp.addip_noauth) |
285 | asoc->peer.asconf_capable = 1; | 286 | asoc->peer.asconf_capable = 1; |
286 | asoc->asconf_addr_del_pending = NULL; | 287 | asoc->asconf_addr_del_pending = NULL; |
287 | asoc->src_out_of_asoc_ok = 0; | 288 | asoc->src_out_of_asoc_ok = 0; |
@@ -641,6 +642,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, | |||
641 | const gfp_t gfp, | 642 | const gfp_t gfp, |
642 | const int peer_state) | 643 | const int peer_state) |
643 | { | 644 | { |
645 | struct net *net = sock_net(asoc->base.sk); | ||
644 | struct sctp_transport *peer; | 646 | struct sctp_transport *peer; |
645 | struct sctp_sock *sp; | 647 | struct sctp_sock *sp; |
646 | unsigned short port; | 648 | unsigned short port; |
@@ -674,7 +676,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, | |||
674 | return peer; | 676 | return peer; |
675 | } | 677 | } |
676 | 678 | ||
677 | peer = sctp_transport_new(addr, gfp); | 679 | peer = sctp_transport_new(net, addr, gfp); |
678 | if (!peer) | 680 | if (!peer) |
679 | return NULL; | 681 | return NULL; |
680 | 682 | ||
@@ -1089,13 +1091,15 @@ out: | |||
1089 | 1091 | ||
1090 | /* Is this the association we are looking for? */ | 1092 | /* Is this the association we are looking for? */ |
1091 | struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc, | 1093 | struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc, |
1094 | struct net *net, | ||
1092 | const union sctp_addr *laddr, | 1095 | const union sctp_addr *laddr, |
1093 | const union sctp_addr *paddr) | 1096 | const union sctp_addr *paddr) |
1094 | { | 1097 | { |
1095 | struct sctp_transport *transport; | 1098 | struct sctp_transport *transport; |
1096 | 1099 | ||
1097 | if ((htons(asoc->base.bind_addr.port) == laddr->v4.sin_port) && | 1100 | if ((htons(asoc->base.bind_addr.port) == laddr->v4.sin_port) && |
1098 | (htons(asoc->peer.port) == paddr->v4.sin_port)) { | 1101 | (htons(asoc->peer.port) == paddr->v4.sin_port) && |
1102 | net_eq(sock_net(asoc->base.sk), net)) { | ||
1099 | transport = sctp_assoc_lookup_paddr(asoc, paddr); | 1103 | transport = sctp_assoc_lookup_paddr(asoc, paddr); |
1100 | if (!transport) | 1104 | if (!transport) |
1101 | goto out; | 1105 | goto out; |
@@ -1116,6 +1120,7 @@ static void sctp_assoc_bh_rcv(struct work_struct *work) | |||
1116 | struct sctp_association *asoc = | 1120 | struct sctp_association *asoc = |
1117 | container_of(work, struct sctp_association, | 1121 | container_of(work, struct sctp_association, |
1118 | base.inqueue.immediate); | 1122 | base.inqueue.immediate); |
1123 | struct net *net = sock_net(asoc->base.sk); | ||
1119 | struct sctp_endpoint *ep; | 1124 | struct sctp_endpoint *ep; |
1120 | struct sctp_chunk *chunk; | 1125 | struct sctp_chunk *chunk; |
1121 | struct sctp_inq *inqueue; | 1126 | struct sctp_inq *inqueue; |
@@ -1148,13 +1153,13 @@ static void sctp_assoc_bh_rcv(struct work_struct *work) | |||
1148 | if (sctp_chunk_is_data(chunk)) | 1153 | if (sctp_chunk_is_data(chunk)) |
1149 | asoc->peer.last_data_from = chunk->transport; | 1154 | asoc->peer.last_data_from = chunk->transport; |
1150 | else | 1155 | else |
1151 | SCTP_INC_STATS(SCTP_MIB_INCTRLCHUNKS); | 1156 | SCTP_INC_STATS(net, SCTP_MIB_INCTRLCHUNKS); |
1152 | 1157 | ||
1153 | if (chunk->transport) | 1158 | if (chunk->transport) |
1154 | chunk->transport->last_time_heard = jiffies; | 1159 | chunk->transport->last_time_heard = jiffies; |
1155 | 1160 | ||
1156 | /* Run through the state machine. */ | 1161 | /* Run through the state machine. */ |
1157 | error = sctp_do_sm(SCTP_EVENT_T_CHUNK, subtype, | 1162 | error = sctp_do_sm(net, SCTP_EVENT_T_CHUNK, subtype, |
1158 | state, ep, asoc, chunk, GFP_ATOMIC); | 1163 | state, ep, asoc, chunk, GFP_ATOMIC); |
1159 | 1164 | ||
1160 | /* Check to see if the association is freed in response to | 1165 | /* Check to see if the association is freed in response to |
@@ -1414,6 +1419,7 @@ void sctp_assoc_sync_pmtu(struct sock *sk, struct sctp_association *asoc) | |||
1414 | /* Should we send a SACK to update our peer? */ | 1419 | /* Should we send a SACK to update our peer? */ |
1415 | static inline int sctp_peer_needs_update(struct sctp_association *asoc) | 1420 | static inline int sctp_peer_needs_update(struct sctp_association *asoc) |
1416 | { | 1421 | { |
1422 | struct net *net = sock_net(asoc->base.sk); | ||
1417 | switch (asoc->state) { | 1423 | switch (asoc->state) { |
1418 | case SCTP_STATE_ESTABLISHED: | 1424 | case SCTP_STATE_ESTABLISHED: |
1419 | case SCTP_STATE_SHUTDOWN_PENDING: | 1425 | case SCTP_STATE_SHUTDOWN_PENDING: |
@@ -1421,7 +1427,7 @@ static inline int sctp_peer_needs_update(struct sctp_association *asoc) | |||
1421 | case SCTP_STATE_SHUTDOWN_SENT: | 1427 | case SCTP_STATE_SHUTDOWN_SENT: |
1422 | if ((asoc->rwnd > asoc->a_rwnd) && | 1428 | if ((asoc->rwnd > asoc->a_rwnd) && |
1423 | ((asoc->rwnd - asoc->a_rwnd) >= max_t(__u32, | 1429 | ((asoc->rwnd - asoc->a_rwnd) >= max_t(__u32, |
1424 | (asoc->base.sk->sk_rcvbuf >> sctp_rwnd_upd_shift), | 1430 | (asoc->base.sk->sk_rcvbuf >> net->sctp.rwnd_upd_shift), |
1425 | asoc->pathmtu))) | 1431 | asoc->pathmtu))) |
1426 | return 1; | 1432 | return 1; |
1427 | break; | 1433 | break; |
@@ -1542,7 +1548,8 @@ int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc, | |||
1542 | if (asoc->peer.ipv6_address) | 1548 | if (asoc->peer.ipv6_address) |
1543 | flags |= SCTP_ADDR6_PEERSUPP; | 1549 | flags |= SCTP_ADDR6_PEERSUPP; |
1544 | 1550 | ||
1545 | return sctp_bind_addr_copy(&asoc->base.bind_addr, | 1551 | return sctp_bind_addr_copy(sock_net(asoc->base.sk), |
1552 | &asoc->base.bind_addr, | ||
1546 | &asoc->ep->base.bind_addr, | 1553 | &asoc->ep->base.bind_addr, |
1547 | scope, gfp, flags); | 1554 | scope, gfp, flags); |
1548 | } | 1555 | } |