netfilter: nfnetlink_log: fix wrong skbuff size calculation
[safe/jmp/linux-2.6] / net / sctp / transport.c
index 9647fb2..e5dde45 100644 (file)
@@ -79,6 +79,7 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
        peer->rttvar = 0;
        peer->srtt = 0;
        peer->rto_pending = 0;
+       peer->hb_sent = 0;
        peer->fast_recovery = 0;
 
        peer->last_time_heard = jiffies;
@@ -100,6 +101,9 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
        INIT_LIST_HEAD(&peer->send_ready);
        INIT_LIST_HEAD(&peer->transports);
 
+       peer->T3_rtx_timer.expires = 0;
+       peer->hb_timer.expires = 0;
+
        setup_timer(&peer->T3_rtx_timer, sctp_generate_t3_rtx_event,
                        (unsigned long)peer);
        setup_timer(&peer->hb_timer, sctp_generate_heartbeat_event,
@@ -191,7 +195,7 @@ static void sctp_transport_destroy(struct sctp_transport *transport)
 /* Start T3_rtx timer if it is not already running and update the heartbeat
  * timer.  This routine is called every time a DATA chunk is sent.
  */
-void sctp_transport_reset_timers(struct sctp_transport *transport)
+void sctp_transport_reset_timers(struct sctp_transport *transport, int force)
 {
        /* RFC 2960 6.3.2 Retransmission Timer Rules
         *
@@ -201,7 +205,7 @@ void sctp_transport_reset_timers(struct sctp_transport *transport)
         * address.
         */
 
-       if (!timer_pending(&transport->T3_rtx_timer))
+       if (force || !timer_pending(&transport->T3_rtx_timer))
                if (!mod_timer(&transport->T3_rtx_timer,
                               jiffies + transport->rto))
                        sctp_transport_hold(transport);
@@ -539,8 +543,8 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
                 * congestion indications more than once every window of
                 * data (or more loosely more than once every round-trip time).
                 */
-               if ((jiffies - transport->last_time_ecne_reduced) >
-                   transport->rtt) {
+               if (time_after(jiffies, transport->last_time_ecne_reduced +
+                                       transport->rtt)) {
                        transport->ssthresh = max(transport->cwnd/2,
                                                  4*transport->asoc->pathmtu);
                        transport->cwnd = transport->ssthresh;
@@ -557,7 +561,8 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
                 * to be done every RTO interval, we do it every hearbeat
                 * interval.
                 */
-               if ((jiffies - transport->last_time_used) > transport->rto)
+               if (time_after(jiffies, transport->last_time_used +
+                                       transport->rto))
                        transport->cwnd = max(transport->cwnd/2,
                                                 4*transport->asoc->pathmtu);
                break;
@@ -605,6 +610,7 @@ void sctp_transport_reset(struct sctp_transport *t)
        t->flight_size = 0;
        t->error_count = 0;
        t->rto_pending = 0;
+       t->hb_sent = 0;
        t->fast_recovery = 0;
 
        /* Initialize the state information for SFR-CACC */