diff options
Diffstat (limited to 'net/sctp/transport.c')
| -rw-r--r-- | net/sctp/transport.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index a431c14044a4..81b86678be4d 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
| @@ -72,7 +72,7 @@ static struct sctp_transport *sctp_transport_init(struct net *net, | |||
| 72 | */ | 72 | */ |
| 73 | peer->rto = msecs_to_jiffies(net->sctp.rto_initial); | 73 | peer->rto = msecs_to_jiffies(net->sctp.rto_initial); |
| 74 | 74 | ||
| 75 | peer->last_time_heard = ktime_get(); | 75 | peer->last_time_heard = ktime_set(0, 0); |
| 76 | peer->last_time_ecne_reduced = jiffies; | 76 | peer->last_time_ecne_reduced = jiffies; |
| 77 | 77 | ||
| 78 | peer->param_flags = SPP_HB_DISABLE | | 78 | peer->param_flags = SPP_HB_DISABLE | |
| @@ -183,7 +183,7 @@ static void sctp_transport_destroy(struct sctp_transport *transport) | |||
| 183 | /* Start T3_rtx timer if it is not already running and update the heartbeat | 183 | /* Start T3_rtx timer if it is not already running and update the heartbeat |
| 184 | * timer. This routine is called every time a DATA chunk is sent. | 184 | * timer. This routine is called every time a DATA chunk is sent. |
| 185 | */ | 185 | */ |
| 186 | void sctp_transport_reset_timers(struct sctp_transport *transport) | 186 | void sctp_transport_reset_t3_rtx(struct sctp_transport *transport) |
| 187 | { | 187 | { |
| 188 | /* RFC 2960 6.3.2 Retransmission Timer Rules | 188 | /* RFC 2960 6.3.2 Retransmission Timer Rules |
| 189 | * | 189 | * |
| @@ -197,11 +197,18 @@ void sctp_transport_reset_timers(struct sctp_transport *transport) | |||
| 197 | if (!mod_timer(&transport->T3_rtx_timer, | 197 | if (!mod_timer(&transport->T3_rtx_timer, |
| 198 | jiffies + transport->rto)) | 198 | jiffies + transport->rto)) |
| 199 | sctp_transport_hold(transport); | 199 | sctp_transport_hold(transport); |
| 200 | } | ||
| 201 | |||
| 202 | void sctp_transport_reset_hb_timer(struct sctp_transport *transport) | ||
| 203 | { | ||
| 204 | unsigned long expires; | ||
| 200 | 205 | ||
| 201 | /* When a data chunk is sent, reset the heartbeat interval. */ | 206 | /* When a data chunk is sent, reset the heartbeat interval. */ |
| 202 | if (!mod_timer(&transport->hb_timer, | 207 | expires = jiffies + sctp_transport_timeout(transport); |
| 203 | sctp_transport_timeout(transport))) | 208 | if (time_before(transport->hb_timer.expires, expires) && |
| 204 | sctp_transport_hold(transport); | 209 | !mod_timer(&transport->hb_timer, |
| 210 | expires + prandom_u32_max(transport->rto))) | ||
| 211 | sctp_transport_hold(transport); | ||
| 205 | } | 212 | } |
| 206 | 213 | ||
| 207 | /* This transport has been assigned to an association. | 214 | /* This transport has been assigned to an association. |
| @@ -226,7 +233,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) | |||
| 226 | } | 233 | } |
| 227 | 234 | ||
| 228 | if (transport->dst) { | 235 | if (transport->dst) { |
| 229 | transport->pathmtu = dst_mtu(transport->dst); | 236 | transport->pathmtu = WORD_TRUNC(dst_mtu(transport->dst)); |
| 230 | } else | 237 | } else |
| 231 | transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; | 238 | transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; |
| 232 | } | 239 | } |
| @@ -280,7 +287,7 @@ void sctp_transport_route(struct sctp_transport *transport, | |||
| 280 | return; | 287 | return; |
| 281 | } | 288 | } |
| 282 | if (transport->dst) { | 289 | if (transport->dst) { |
| 283 | transport->pathmtu = dst_mtu(transport->dst); | 290 | transport->pathmtu = WORD_TRUNC(dst_mtu(transport->dst)); |
| 284 | 291 | ||
| 285 | /* Initialize sk->sk_rcv_saddr, if the transport is the | 292 | /* Initialize sk->sk_rcv_saddr, if the transport is the |
| 286 | * association's active path for getsockname(). | 293 | * association's active path for getsockname(). |
| @@ -595,13 +602,13 @@ void sctp_transport_burst_reset(struct sctp_transport *t) | |||
| 595 | unsigned long sctp_transport_timeout(struct sctp_transport *trans) | 602 | unsigned long sctp_transport_timeout(struct sctp_transport *trans) |
| 596 | { | 603 | { |
| 597 | /* RTO + timer slack +/- 50% of RTO */ | 604 | /* RTO + timer slack +/- 50% of RTO */ |
| 598 | unsigned long timeout = (trans->rto >> 1) + prandom_u32_max(trans->rto); | 605 | unsigned long timeout = trans->rto >> 1; |
| 599 | 606 | ||
| 600 | if (trans->state != SCTP_UNCONFIRMED && | 607 | if (trans->state != SCTP_UNCONFIRMED && |
| 601 | trans->state != SCTP_PF) | 608 | trans->state != SCTP_PF) |
| 602 | timeout += trans->hbinterval; | 609 | timeout += trans->hbinterval; |
| 603 | 610 | ||
| 604 | return timeout + jiffies; | 611 | return timeout; |
| 605 | } | 612 | } |
| 606 | 613 | ||
| 607 | /* Reset transport variables to their initial values */ | 614 | /* Reset transport variables to their initial values */ |
