diff options
Diffstat (limited to 'net/sctp/transport.c')
-rw-r--r-- | net/sctp/transport.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 160f62ad1cc5..2763aa93de1a 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -49,6 +49,7 @@ | |||
49 | */ | 49 | */ |
50 | 50 | ||
51 | #include <linux/types.h> | 51 | #include <linux/types.h> |
52 | #include <linux/random.h> | ||
52 | #include <net/sctp/sctp.h> | 53 | #include <net/sctp/sctp.h> |
53 | #include <net/sctp/sm.h> | 54 | #include <net/sctp/sm.h> |
54 | 55 | ||
@@ -85,7 +86,6 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, | |||
85 | 86 | ||
86 | peer->init_sent_count = 0; | 87 | peer->init_sent_count = 0; |
87 | 88 | ||
88 | peer->state = SCTP_ACTIVE; | ||
89 | peer->param_flags = SPP_HB_DISABLE | | 89 | peer->param_flags = SPP_HB_DISABLE | |
90 | SPP_PMTUD_ENABLE | | 90 | SPP_PMTUD_ENABLE | |
91 | SPP_SACKDELAY_ENABLE; | 91 | SPP_SACKDELAY_ENABLE; |
@@ -109,6 +109,9 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, | |||
109 | peer->hb_timer.function = sctp_generate_heartbeat_event; | 109 | peer->hb_timer.function = sctp_generate_heartbeat_event; |
110 | peer->hb_timer.data = (unsigned long)peer; | 110 | peer->hb_timer.data = (unsigned long)peer; |
111 | 111 | ||
112 | /* Initialize the 64-bit random nonce sent with heartbeat. */ | ||
113 | get_random_bytes(&peer->hb_nonce, sizeof(peer->hb_nonce)); | ||
114 | |||
112 | atomic_set(&peer->refcnt, 1); | 115 | atomic_set(&peer->refcnt, 1); |
113 | peer->dead = 0; | 116 | peer->dead = 0; |
114 | 117 | ||
@@ -517,7 +520,9 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, | |||
517 | unsigned long sctp_transport_timeout(struct sctp_transport *t) | 520 | unsigned long sctp_transport_timeout(struct sctp_transport *t) |
518 | { | 521 | { |
519 | unsigned long timeout; | 522 | unsigned long timeout; |
520 | timeout = t->hbinterval + t->rto + sctp_jitter(t->rto); | 523 | timeout = t->rto + sctp_jitter(t->rto); |
524 | if (t->state != SCTP_UNCONFIRMED) | ||
525 | timeout += t->hbinterval; | ||
521 | timeout += jiffies; | 526 | timeout += jiffies; |
522 | return timeout; | 527 | return timeout; |
523 | } | 528 | } |