summaryrefslogtreecommitdiff
path: root/sys/netinet/sctp_output.c
diff options
context:
space:
mode:
authorRandall Stewart <rrs@FreeBSD.org>2006-11-10 13:34:55 +0000
committerRandall Stewart <rrs@FreeBSD.org>2006-11-10 13:34:55 +0000
commitde0e935b295fea1d11ca176c5d0ec6d0828b3f65 (patch)
tree4170e79a6fb36430770a7d8e40bcc1d85cd50261 /sys/netinet/sctp_output.c
parentaa1eeda578151e40c41ef39dd198979d4bae29a5 (diff)
downloadsrc-test2-de0e935b295fea1d11ca176c5d0ec6d0828b3f65.tar.gz
src-test2-de0e935b295fea1d11ca176c5d0ec6d0828b3f65.zip
Notes
Diffstat (limited to 'sys/netinet/sctp_output.c')
-rw-r--r--sys/netinet/sctp_output.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 76c2d6176993..d8dd14567538 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -3371,14 +3371,8 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
/* populate any tie tags */
if (asoc != NULL) {
/* unlock before tag selections */
- if (asoc->my_vtag_nonce == 0)
- asoc->my_vtag_nonce = sctp_select_a_tag(inp);
stc.tie_tag_my_vtag = asoc->my_vtag_nonce;
-
- if (asoc->peer_vtag_nonce == 0)
- asoc->peer_vtag_nonce = sctp_select_a_tag(inp);
stc.tie_tag_peer_vtag = asoc->peer_vtag_nonce;
-
stc.cookie_life = asoc->cookie_life;
net = asoc->primary_destination;
} else {
@@ -3628,9 +3622,19 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
initackm_out->msg.init.initiate_tag = htonl(asoc->my_vtag);
initackm_out->msg.init.initial_tsn = htonl(asoc->init_seq_number);
} else {
- initackm_out->msg.init.initiate_tag = htonl(sctp_select_a_tag(inp));
- /* get a TSN to use too */
- initackm_out->msg.init.initial_tsn = htonl(sctp_select_initial_TSN(&inp->sctp_ep));
+ if (asoc) {
+ atomic_add_int(&asoc->refcnt, 1);
+ SCTP_TCB_UNLOCK(stcb);
+ initackm_out->msg.init.initiate_tag = htonl(sctp_select_a_tag(inp));
+ /* get a TSN to use too */
+ initackm_out->msg.init.initial_tsn = htonl(sctp_select_initial_TSN(&inp->sctp_ep));
+ SCTP_TCB_LOCK(stcb);
+ atomic_add_int(&asoc->refcnt, -1);
+ } else {
+ initackm_out->msg.init.initiate_tag = htonl(sctp_select_a_tag(inp));
+ /* get a TSN to use too */
+ initackm_out->msg.init.initial_tsn = htonl(sctp_select_initial_TSN(&inp->sctp_ep));
+ }
}
/* save away my tag to */
stc.my_vtag = initackm_out->msg.init.initiate_tag;