Merge tag 'leds-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel...
[linux-2.6-microblaze.git] / net / sctp / sm_statefuns.c
index fd1e319..09a8f23 100644 (file)
@@ -361,7 +361,7 @@ enum sctp_disposition sctp_sf_do_5_1B_init(struct net *net,
 
        /* If the INIT is coming toward a closing socket, we'll send back
         * and ABORT.  Essentially, this catches the race of INIT being
-        * backloged to the socket at the same time as the user isses close().
+        * backloged to the socket at the same time as the user issues close().
         * Since the socket and all its associations are going away, we
         * can treat this OOTB
         */
@@ -608,8 +608,8 @@ enum sctp_disposition sctp_sf_do_5_1C_ack(struct net *net,
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_COOKIE_ECHOED));
 
-       /* SCTP-AUTH: genereate the assocition shared keys so that
-        * we can potentially signe the COOKIE-ECHO.
+       /* SCTP-AUTH: generate the association shared keys so that
+        * we can potentially sign the COOKIE-ECHO.
         */
        sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_SHKEY, SCTP_NULL());
 
@@ -787,7 +787,7 @@ enum sctp_disposition sctp_sf_do_5_1D_ce(struct net *net,
                goto nomem_init;
 
        /* SCTP-AUTH:  Now that we've populate required fields in
-        * sctp_process_init, set up the assocaition shared keys as
+        * sctp_process_init, set up the association shared keys as
         * necessary so that we can potentially authenticate the ACK
         */
        error = sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC);
@@ -838,7 +838,7 @@ enum sctp_disposition sctp_sf_do_5_1D_ce(struct net *net,
 
        /* Add all the state machine commands now since we've created
         * everything.  This way we don't introduce memory corruptions
-        * during side-effect processing and correclty count established
+        * during side-effect processing and correctly count established
         * associations.
         */
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc));
@@ -923,7 +923,7 @@ enum sctp_disposition sctp_sf_do_5_1E_ca(struct net *net,
                                                  commands);
 
        /* Reset init error count upon receipt of COOKIE-ACK,
-        * to avoid problems with the managemement of this
+        * to avoid problems with the management of this
         * counter in stale cookie situations when a transition back
         * from the COOKIE-ECHOED state to the COOKIE-WAIT
         * state is performed.
@@ -1004,7 +1004,7 @@ static enum sctp_disposition sctp_sf_heartbeat(
        struct sctp_chunk *reply;
 
        /* Send a heartbeat to our peer.  */
-       reply = sctp_make_heartbeat(asoc, transport);
+       reply = sctp_make_heartbeat(asoc, transport, 0);
        if (!reply)
                return SCTP_DISPOSITION_NOMEM;
 
@@ -1095,6 +1095,32 @@ enum sctp_disposition sctp_sf_send_reconf(struct net *net,
        return SCTP_DISPOSITION_CONSUME;
 }
 
+/* send hb chunk with padding for PLPMUTD.  */
+enum sctp_disposition sctp_sf_send_probe(struct net *net,
+                                        const struct sctp_endpoint *ep,
+                                        const struct sctp_association *asoc,
+                                        const union sctp_subtype type,
+                                        void *arg,
+                                        struct sctp_cmd_seq *commands)
+{
+       struct sctp_transport *transport = (struct sctp_transport *)arg;
+       struct sctp_chunk *reply;
+
+       if (!sctp_transport_pl_enabled(transport))
+               return SCTP_DISPOSITION_CONSUME;
+
+       sctp_transport_pl_send(transport);
+
+       reply = sctp_make_heartbeat(asoc, transport, transport->pl.probe_size);
+       if (!reply)
+               return SCTP_DISPOSITION_NOMEM;
+       sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
+       sctp_add_cmd_sf(commands, SCTP_CMD_PROBE_TIMER_UPDATE,
+                       SCTP_TRANSPORT(transport));
+
+       return SCTP_DISPOSITION_CONSUME;
+}
+
 /*
  * Process an heartbeat request.
  *
@@ -1243,6 +1269,18 @@ enum sctp_disposition sctp_sf_backbeat_8_3(struct net *net,
        if (hbinfo->hb_nonce != link->hb_nonce)
                return SCTP_DISPOSITION_DISCARD;
 
+       if (hbinfo->probe_size) {
+               if (hbinfo->probe_size != link->pl.probe_size ||
+                   !sctp_transport_pl_enabled(link))
+                       return SCTP_DISPOSITION_DISCARD;
+
+               sctp_transport_pl_recv(link);
+               if (link->pl.state == SCTP_PL_COMPLETE)
+                       return SCTP_DISPOSITION_CONSUME;
+
+               return sctp_sf_send_probe(net, ep, asoc, type, link, commands);
+       }
+
        max_interval = link->hbinterval + link->rto;
 
        /* Check if the timestamp looks valid.  */
@@ -2950,7 +2988,7 @@ enum sctp_disposition sctp_sf_do_9_2_reshutack(
                                                  commands);
 
        /* Since we are not going to really process this INIT, there
-        * is no point in verifying chunk boundries.  Just generate
+        * is no point in verifying chunk boundaries.  Just generate
         * the SHUTDOWN ACK.
         */
        reply = sctp_make_shutdown_ack(asoc, chunk);
@@ -3560,7 +3598,7 @@ enum sctp_disposition sctp_sf_do_9_2_final(struct net *net,
                goto nomem_chunk;
 
        /* Do all the commands now (after allocation), so that we
-        * have consistent state if memory allocation failes
+        * have consistent state if memory allocation fails
         */
        sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev));
 
@@ -3747,7 +3785,7 @@ static enum sctp_disposition sctp_sf_shut_8_4_5(
                return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
 
        /* We need to discard the rest of the packet to prevent
-        * potential bomming attacks from additional bundled chunks.
+        * potential boomming attacks from additional bundled chunks.
         * This is documented in SCTP Threats ID.
         */
        return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
@@ -4257,7 +4295,7 @@ gen_shutdown:
 }
 
 /*
- * SCTP-AUTH Section 6.3 Receiving authenticated chukns
+ * SCTP-AUTH Section 6.3 Receiving authenticated chunks
  *
  *    The receiver MUST use the HMAC algorithm indicated in the HMAC
  *    Identifier field.  If this algorithm was not specified by the
@@ -4812,7 +4850,7 @@ static enum sctp_disposition sctp_sf_violation_ctsn(
 
 /* Handle protocol violation of an invalid chunk bundling.  For example,
  * when we have an association and we receive bundled INIT-ACK, or
- * SHUDOWN-COMPLETE, our peer is clearly violationg the "MUST NOT bundle"
+ * SHUTDOWN-COMPLETE, our peer is clearly violating the "MUST NOT bundle"
  * statement from the specs.  Additionally, there might be an attacker
  * on the path and we may not want to continue this communication.
  */
@@ -5208,7 +5246,7 @@ enum sctp_disposition sctp_sf_cookie_wait_prm_shutdown(
  * Inputs
  * (endpoint, asoc)
  *
- * The RFC does not explcitly address this issue, but is the route through the
+ * The RFC does not explicitly address this issue, but is the route through the
  * state table when someone issues a shutdown while in COOKIE_ECHOED state.
  *
  * Outputs
@@ -5932,7 +5970,7 @@ enum sctp_disposition sctp_sf_t1_cookie_timer_expire(
 /* RFC2960 9.2 If the timer expires, the endpoint must re-send the SHUTDOWN
  * with the updated last sequential TSN received from its peer.
  *
- * An endpoint should limit the number of retransmissions of the
+ * An endpoint should limit the number of retransmission of the
  * SHUTDOWN chunk to the protocol parameter 'Association.Max.Retrans'.
  * If this threshold is exceeded the endpoint should destroy the TCB and
  * MUST report the peer endpoint unreachable to the upper layer (and
@@ -6010,7 +6048,7 @@ nomem:
 }
 
 /*
- * ADDIP Section 4.1 ASCONF CHunk Procedures
+ * ADDIP Section 4.1 ASCONF Chunk Procedures
  * If the T4 RTO timer expires the endpoint should do B1 to B5
  */
 enum sctp_disposition sctp_sf_t4_timer_expire(
@@ -6441,7 +6479,7 @@ static int sctp_eat_data(const struct sctp_association *asoc,
                chunk->ecn_ce_done = 1;
 
                if (af->is_ce(sctp_gso_headskb(chunk->skb))) {
-                       /* Do real work as sideffect. */
+                       /* Do real work as side effect. */
                        sctp_add_cmd_sf(commands, SCTP_CMD_ECN_CE,
                                        SCTP_U32(tsn));
                }