]> err.no Git - linux-2.6/blobdiff - net/sctp/sm_sideeffect.c
tipc: Fix skb_under_panic when configuring TIPC without privileges
[linux-2.6] / net / sctp / sm_sideeffect.c
index 23a9f1a95b7d1f0f6b87c4b495880a954aa5502f..b083312c725aa03294771a5858a4840c806ef924 100644 (file)
@@ -190,20 +190,28 @@ static int sctp_gen_sack(struct sctp_association *asoc, int force,
         * unacknowledged DATA chunk. ...
         */
        if (!asoc->peer.sack_needed) {
-               /* We will need a SACK for the next packet.  */
-               asoc->peer.sack_needed = 1;
+               asoc->peer.sack_cnt++;
 
                /* Set the SACK delay timeout based on the
                 * SACK delay for the last transport
                 * data was received from, or the default
                 * for the association.
                 */
-               if (trans)
+               if (trans) {
+                       /* We will need a SACK for the next packet.  */
+                       if (asoc->peer.sack_cnt >= trans->sackfreq - 1)
+                               asoc->peer.sack_needed = 1;
+
                        asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] =
                                trans->sackdelay;
-               else
+               } else {
+                       /* We will need a SACK for the next packet.  */
+                       if (asoc->peer.sack_cnt >= asoc->sackfreq - 1)
+                               asoc->peer.sack_needed = 1;
+
                        asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] =
                                asoc->sackdelay;
+               }
 
                /* Restart the SACK timer. */
                sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART,
@@ -216,6 +224,7 @@ static int sctp_gen_sack(struct sctp_association *asoc, int force,
                        goto nomem;
 
                asoc->peer.sack_needed = 0;
+               asoc->peer.sack_cnt = 0;
 
                sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(sack));