[NET]: cleanup extra semicolons
[powerpc.git] / net / sctp / associola.c
index fa7cda4..db73ef9 100644 (file)
@@ -52,7 +52,6 @@
 #include <linux/fcntl.h>
 #include <linux/poll.h>
 #include <linux/init.h>
-#include <linux/sched.h>
 
 #include <linux/slab.h>
 #include <linux/in.h>
@@ -61,7 +60,7 @@
 #include <net/sctp/sm.h>
 
 /* Forward declarations for internal functions. */
-static void sctp_assoc_bh_rcv(struct sctp_association *asoc);
+static void sctp_assoc_bh_rcv(struct work_struct *work);
 
 
 /* 1st Level Abstractions. */
@@ -144,7 +143,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
        /* Initialize the maximum mumber of new data packets that can be sent
         * in a burst.
         */
-       asoc->max_burst = sctp_max_burst;
+       asoc->max_burst = sp->max_burst;
 
        /* initialize association timers */
        asoc->timeouts[SCTP_EVENT_TIMEOUT_NONE] = 0;
@@ -158,14 +157,14 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
         * If the 'T5-shutdown-guard' timer is used, it SHOULD be set to the
         * recommended value of 5 times 'RTO.Max'.
         */
-        asoc->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD]
+       asoc->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD]
                = 5 * asoc->rto_max;
 
        asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0;
        asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay;
        asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] =
                sp->autoclose * HZ;
-       
+
        /* Initilizes the timers */
        for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) {
                init_timer(&asoc->timers[i]);
@@ -269,9 +268,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
 
        /* Create an input queue.  */
        sctp_inq_init(&asoc->base.inqueue);
-       sctp_inq_set_th_handler(&asoc->base.inqueue,
-                                   (void (*)(void *))sctp_assoc_bh_rcv,
-                                   asoc);
+       sctp_inq_set_th_handler(&asoc->base.inqueue, sctp_assoc_bh_rcv);
 
        /* Create an output queue.  */
        sctp_outq_init(asoc, &asoc->outqueue);
@@ -300,6 +297,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
        asoc->default_flags = sp->default_flags;
        asoc->default_context = sp->default_context;
        asoc->default_timetolive = sp->default_timetolive;
+       asoc->default_rcv_context = sp->default_rcv_context;
 
        return asoc;
 
@@ -716,8 +714,16 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
        /* Record the transition on the transport.  */
        switch (command) {
        case SCTP_TRANSPORT_UP:
+               /* If we are moving from UNCONFIRMED state due
+                * to heartbeat success, report the SCTP_ADDR_CONFIRMED
+                * state to the user, otherwise report SCTP_ADDR_AVAILABLE.
+                */
+               if (SCTP_UNCONFIRMED == transport->state &&
+                   SCTP_HEARTBEAT_SUCCESS == error)
+                       spc_state = SCTP_ADDR_CONFIRMED;
+               else
+                       spc_state = SCTP_ADDR_AVAILABLE;
                transport->state = SCTP_ACTIVE;
-               spc_state = SCTP_ADDR_AVAILABLE;
                break;
 
        case SCTP_TRANSPORT_DOWN:
@@ -727,13 +733,13 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
 
        default:
                return;
-       };
+       }
 
        /* Generate and send a SCTP_PEER_ADDR_CHANGE notification to the
         * user.
         */
        memset(&addr, 0, sizeof(struct sockaddr_storage));
-       flip_to_n((union sctp_addr *)&addr, &transport->ipaddr_h);
+       memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len);
        event = sctp_ulpevent_make_peer_addr_change(asoc, &addr,
                                0, spc_state, error, GFP_ATOMIC);
        if (event)
@@ -946,8 +952,11 @@ out:
 }
 
 /* Do delayed input processing.  This is scheduled by sctp_rcv(). */
-static void sctp_assoc_bh_rcv(struct sctp_association *asoc)
+static void sctp_assoc_bh_rcv(struct work_struct *work)
 {
+       struct sctp_association *asoc =
+               container_of(work, struct sctp_association,
+                            base.inqueue.immediate);
        struct sctp_endpoint *ep;
        struct sctp_chunk *chunk;
        struct sock *sk;
@@ -1045,6 +1054,9 @@ void sctp_assoc_update(struct sctp_association *asoc,
                trans = list_entry(pos, struct sctp_transport, transports);
                if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr))
                        sctp_assoc_del_peer(asoc, &trans->ipaddr);
+
+               if (asoc->state >= SCTP_STATE_ESTABLISHED)
+                       sctp_transport_reset(trans);
        }
 
        /* If the case is A (association restart), use
@@ -1062,6 +1074,18 @@ void sctp_assoc_update(struct sctp_association *asoc,
                 */
                sctp_ssnmap_clear(asoc->ssnmap);
 
+               /* Flush the ULP reassembly and ordered queue.
+                * Any data there will now be stale and will
+                * cause problems.
+                */
+               sctp_ulpq_flush(&asoc->ulpq);
+
+               /* reset the overall association error count so
+                * that the restarted association doesn't get torn
+                * down on the next retransmission timer.
+                */
+               asoc->overall_error_count = 0;
+
        } else {
                /* Add any peer addresses from the new association. */
                list_for_each(pos, &new->peer.transport_addr_list) {
@@ -1332,8 +1356,8 @@ int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc,
                                      asoc->ep->base.bind_addr.port, gfp);
 }
 
-/* Lookup laddr in the bind address list of an association. */ 
-int sctp_assoc_lookup_laddr(struct sctp_association *asoc, 
+/* Lookup laddr in the bind address list of an association. */
+int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
                            const union sctp_addr *laddr)
 {
        int found;
@@ -1341,7 +1365,7 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
        sctp_read_lock(&asoc->base.addr_lock);
        if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) &&
            sctp_bind_addr_match(&asoc->base.bind_addr, laddr,
-                                sctp_sk(asoc->base.sk))) {
+                                sctp_sk(asoc->base.sk))) {
                found = 1;
                goto out;
        }