summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctputil.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2007-05-29 09:29:03 +0000
committerrrs <rrs@FreeBSD.org>2007-05-29 09:29:03 +0000
commitf827c93ac67113093cd06e755372cf7cd9302d8f (patch)
treeb0a3898608d9bf9a7a2b4c780e734bf27af057e1 /sys/netinet/sctputil.c
parent0cadc213d533d92acab0d770376baacbd16de8bf (diff)
downloadFreeBSD-src-f827c93ac67113093cd06e755372cf7cd9302d8f.zip
FreeBSD-src-f827c93ac67113093cd06e755372cf7cd9302d8f.tar.gz
- Fixes so we won't try to start a timer when we
hold a wq lock for the iterator. Panda uses a silly recursive lock they hold through the timer. - Add poor mans wireshark compile option.. - Allocate and start using SCTP_M_XXX for all SCTP_MALLOC() calls. - sysctl now will get back the refcnt for viewing by onlookers. Reviewed by: gnn
Diffstat (limited to 'sys/netinet/sctputil.c')
-rw-r--r--sys/netinet/sctputil.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index 7558875..736a562 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -1061,7 +1061,7 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_association *asoc,
m->sctp_ep.pre_open_stream_count;
SCTP_MALLOC(asoc->strmout, struct sctp_stream_out *,
asoc->streamoutcnt * sizeof(struct sctp_stream_out),
- "StreamsOut");
+ SCTP_M_STRMO);
if (asoc->strmout == NULL) {
/* big trouble no memory */
return (ENOMEM);
@@ -1085,9 +1085,9 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_association *asoc,
/* Now the mapping array */
asoc->mapping_array_size = SCTP_INITIAL_MAPPING_ARRAY;
SCTP_MALLOC(asoc->mapping_array, uint8_t *, asoc->mapping_array_size,
- "MappingArray");
+ SCTP_M_MAP);
if (asoc->mapping_array == NULL) {
- SCTP_FREE(asoc->strmout);
+ SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
return (ENOMEM);
}
memset(asoc->mapping_array, 0, asoc->mapping_array_size);
@@ -1129,7 +1129,7 @@ sctp_expand_mapping_array(struct sctp_association *asoc)
uint16_t new_size;
new_size = asoc->mapping_array_size + SCTP_MAPPING_ARRAY_INCR;
- SCTP_MALLOC(new_array, uint8_t *, new_size, "MappingArray");
+ SCTP_MALLOC(new_array, uint8_t *, new_size, SCTP_M_MAP);
if (new_array == NULL) {
/* can't get more, forget it */
SCTP_PRINTF("No memory for expansion of SCTP mapping array %d\n",
@@ -1138,7 +1138,7 @@ sctp_expand_mapping_array(struct sctp_association *asoc)
}
memset(new_array, 0, new_size);
memcpy(new_array, asoc->mapping_array, asoc->mapping_array_size);
- SCTP_FREE(asoc->mapping_array);
+ SCTP_FREE(asoc->mapping_array, SCTP_M_MAP);
asoc->mapping_array = new_array;
asoc->mapping_array_size = new_size;
return (0);
@@ -1162,7 +1162,7 @@ done_with_iterator:
if (it->function_atend != NULL) {
(*it->function_atend) (it->pointer, it->val);
}
- SCTP_FREE(it);
+ SCTP_FREE(it, SCTP_M_ITER);
return;
}
select_a_new_ep:
@@ -1314,7 +1314,7 @@ sctp_handle_addr_wq(void)
struct sctp_asconf_iterator *asc;
SCTP_MALLOC(asc, struct sctp_asconf_iterator *,
- sizeof(struct sctp_asconf_iterator), "SCTP_ASCONF_ITERATOR");
+ sizeof(struct sctp_asconf_iterator), SCTP_M_ASC_IT);
if (asc == NULL) {
/* Try later, no memory */
sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ,
@@ -1335,7 +1335,7 @@ sctp_handle_addr_wq(void)
}
SCTP_IPI_ITERATOR_WQ_UNLOCK();
if (asc->cnt == 0) {
- SCTP_FREE(asc);
+ SCTP_FREE(asc, SCTP_M_ASC_IT);
} else {
(void)sctp_initiate_iterator(sctp_iterator_ep,
sctp_iterator_stcb,
@@ -1426,6 +1426,9 @@ sctp_timeout_handler(void *t)
if (inp) {
SCTP_INP_DECR_REF(inp);
}
+ if (stcb) {
+ atomic_add_int(&stcb->asoc.refcnt, -1);
+ }
return;
}
tmr->stopped_from = 0xa006;
@@ -4945,6 +4948,8 @@ found_one:
* to increment, we need to use the atomic add to
* the refcnt
*/
+ if (freecnt_applied)
+ panic("refcnt already incremented");
atomic_add_int(&stcb->asoc.refcnt, 1);
freecnt_applied = 1;
/*
OpenPOWER on IntegriCloud