aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/associola.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /net/sctp/associola.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r--net/sctp/associola.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 0b85e5256434..4a62888f2e43 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -48,6 +48,8 @@
48 * be incorporated into the next SCTP release. 48 * be incorporated into the next SCTP release.
49 */ 49 */
50 50
51#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
52
51#include <linux/types.h> 53#include <linux/types.h>
52#include <linux/fcntl.h> 54#include <linux/fcntl.h>
53#include <linux/poll.h> 55#include <linux/poll.h>
@@ -62,6 +64,7 @@
62/* Forward declarations for internal functions. */ 64/* Forward declarations for internal functions. */
63static void sctp_assoc_bh_rcv(struct work_struct *work); 65static void sctp_assoc_bh_rcv(struct work_struct *work);
64static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc); 66static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc);
67static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc);
65 68
66/* Keep track of the new idr low so that we don't re-use association id 69/* Keep track of the new idr low so that we don't re-use association id
67 * numbers too fast. It is protected by they idr spin lock is in the 70 * numbers too fast. It is protected by they idr spin lock is in the
@@ -441,12 +444,7 @@ void sctp_association_free(struct sctp_association *asoc)
441 444
442 asoc->peer.transport_count = 0; 445 asoc->peer.transport_count = 0;
443 446
444 /* Free any cached ASCONF_ACK chunk. */ 447 sctp_asconf_queue_teardown(asoc);
445 sctp_assoc_free_asconf_acks(asoc);
446
447 /* Free any cached ASCONF chunk. */
448 if (asoc->addip_last_asconf)
449 sctp_chunk_free(asoc->addip_last_asconf);
450 448
451 /* AUTH - Free the endpoint shared keys */ 449 /* AUTH - Free the endpoint shared keys */
452 sctp_auth_destroy_keys(&asoc->endpoint_shared_keys); 450 sctp_auth_destroy_keys(&asoc->endpoint_shared_keys);
@@ -567,6 +565,8 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,
567 sctp_assoc_set_primary(asoc, transport); 565 sctp_assoc_set_primary(asoc, transport);
568 if (asoc->peer.active_path == peer) 566 if (asoc->peer.active_path == peer)
569 asoc->peer.active_path = transport; 567 asoc->peer.active_path = transport;
568 if (asoc->peer.retran_path == peer)
569 asoc->peer.retran_path = transport;
570 if (asoc->peer.last_data_from == peer) 570 if (asoc->peer.last_data_from == peer)
571 asoc->peer.last_data_from = transport; 571 asoc->peer.last_data_from = transport;
572 572
@@ -1087,7 +1087,6 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
1087 base.inqueue.immediate); 1087 base.inqueue.immediate);
1088 struct sctp_endpoint *ep; 1088 struct sctp_endpoint *ep;
1089 struct sctp_chunk *chunk; 1089 struct sctp_chunk *chunk;
1090 struct sock *sk;
1091 struct sctp_inq *inqueue; 1090 struct sctp_inq *inqueue;
1092 int state; 1091 int state;
1093 sctp_subtype_t subtype; 1092 sctp_subtype_t subtype;
@@ -1095,7 +1094,6 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
1095 1094
1096 /* The association should be held so we should be safe. */ 1095 /* The association should be held so we should be safe. */
1097 ep = asoc->ep; 1096 ep = asoc->ep;
1098 sk = asoc->base.sk;
1099 1097
1100 inqueue = &asoc->base.inqueue; 1098 inqueue = &asoc->base.inqueue;
1101 sctp_association_hold(asoc); 1099 sctp_association_hold(asoc);
@@ -1323,6 +1321,8 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
1323 1321
1324 if (t) 1322 if (t)
1325 asoc->peer.retran_path = t; 1323 asoc->peer.retran_path = t;
1324 else
1325 t = asoc->peer.retran_path;
1326 1326
1327 SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_update_retran_path:association" 1327 SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_update_retran_path:association"
1328 " %p addr: ", 1328 " %p addr: ",
@@ -1574,6 +1574,18 @@ retry:
1574 return error; 1574 return error;
1575} 1575}
1576 1576
1577/* Free the ASCONF queue */
1578static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc)
1579{
1580 struct sctp_chunk *asconf;
1581 struct sctp_chunk *tmp;
1582
1583 list_for_each_entry_safe(asconf, tmp, &asoc->addip_chunk_list, list) {
1584 list_del_init(&asconf->list);
1585 sctp_chunk_free(asconf);
1586 }
1587}
1588
1577/* Free asconf_ack cache */ 1589/* Free asconf_ack cache */
1578static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc) 1590static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc)
1579{ 1591{
@@ -1593,7 +1605,7 @@ void sctp_assoc_clean_asconf_ack_cache(const struct sctp_association *asoc)
1593 struct sctp_chunk *ack; 1605 struct sctp_chunk *ack;
1594 struct sctp_chunk *tmp; 1606 struct sctp_chunk *tmp;
1595 1607
1596 /* We can remove all the entries from the queue upto 1608 /* We can remove all the entries from the queue up to
1597 * the "Peer-Sequence-Number". 1609 * the "Peer-Sequence-Number".
1598 */ 1610 */
1599 list_for_each_entry_safe(ack, tmp, &asoc->asconf_ack_list, 1611 list_for_each_entry_safe(ack, tmp, &asoc->asconf_ack_list,
@@ -1626,3 +1638,16 @@ struct sctp_chunk *sctp_assoc_lookup_asconf_ack(
1626 1638
1627 return NULL; 1639 return NULL;
1628} 1640}
1641
1642void sctp_asconf_queue_teardown(struct sctp_association *asoc)
1643{
1644 /* Free any cached ASCONF_ACK chunk. */
1645 sctp_assoc_free_asconf_acks(asoc);
1646
1647 /* Free the ASCONF queue. */
1648 sctp_assoc_free_asconf_queue(asoc);
1649
1650 /* Free any cached ASCONF chunk. */
1651 if (asoc->addip_last_asconf)
1652 sctp_chunk_free(asoc->addip_last_asconf);
1653}