summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/sctp_timer.c')
-rw-r--r--sys/netinet/sctp_timer.c125
1 files changed, 49 insertions, 76 deletions
diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index a8594c9..b027f0b 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -171,13 +171,9 @@ sctp_audit_retranmission_queue(struct sctp_association *asoc)
{
struct sctp_tmit_chunk *chk;
-#ifdef SCTP_DEBUG
- if (sctp_debug_on & SCTP_DEBUG_TIMER4) {
- printf("Audit invoked on send queue cnt:%d onqueue:%d\n",
- asoc->sent_queue_retran_cnt,
- asoc->sent_queue_cnt);
- }
-#endif /* SCTP_DEBUG */
+ SCTPDBG(SCTP_DEBUG_TIMER4, "Audit invoked on send queue cnt:%d onqueue:%d\n",
+ asoc->sent_queue_retran_cnt,
+ asoc->sent_queue_cnt);
asoc->sent_queue_retran_cnt = 0;
asoc->sent_queue_cnt = 0;
TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
@@ -191,13 +187,9 @@ sctp_audit_retranmission_queue(struct sctp_association *asoc)
sctp_ucount_incr(asoc->sent_queue_retran_cnt);
}
}
-#ifdef SCTP_DEBUG
- if (sctp_debug_on & SCTP_DEBUG_TIMER4) {
- printf("Audit completes retran:%d onqueue:%d\n",
- asoc->sent_queue_retran_cnt,
- asoc->sent_queue_cnt);
- }
-#endif /* SCTP_DEBUG */
+ SCTPDBG(SCTP_DEBUG_TIMER4, "Audit completes retran:%d onqueue:%d\n",
+ asoc->sent_queue_retran_cnt,
+ asoc->sent_queue_cnt);
}
int
@@ -206,13 +198,9 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
{
if (net) {
net->error_count++;
-#ifdef SCTP_DEBUG
- if (sctp_debug_on & SCTP_DEBUG_TIMER4) {
- printf("Error count for %p now %d thresh:%d\n",
- net, net->error_count,
- net->failure_threshold);
- }
-#endif /* SCTP_DEBUG */
+ SCTPDBG(SCTP_DEBUG_TIMER4, "Error count for %p now %d thresh:%d\n",
+ net, net->error_count,
+ net->failure_threshold);
if (net->error_count > net->failure_threshold) {
/* We had a threshold failure */
if (net->dest_state & SCTP_ADDR_REACHABLE) {
@@ -245,15 +233,10 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
} else {
stcb->asoc.overall_error_count++;
}
-#ifdef SCTP_DEBUG
- if (sctp_debug_on & SCTP_DEBUG_TIMER4) {
- printf("Overall error count for %p now %d thresh:%u state:%x\n",
- &stcb->asoc,
- stcb->asoc.overall_error_count,
- (uint32_t) threshold,
- ((net == NULL) ? (uint32_t) 0 : (uint32_t) net->dest_state));
- }
-#endif /* SCTP_DEBUG */
+ SCTPDBG(SCTP_DEBUG_TIMER4, "Overall error count for %p now %d thresh:%u state:%x\n",
+ &stcb->asoc, stcb->asoc.overall_error_count,
+ (uint32_t) threshold,
+ ((net == NULL) ? (uint32_t) 0 : (uint32_t) net->dest_state));
/*
* We specifically do not do >= to give the assoc one more change
* before we fail it.
@@ -528,7 +511,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
MAX_TSN)) ||
(stcb->asoc.last_acked_seq == chk->rec.data.TSN_seq)) {
/* Strange case our list got out of order? */
- printf("Our list is out of order?\n");
+ SCTP_PRINTF("Our list is out of order?\n");
panic("Out of order list");
}
if ((chk->whoTo == net) && (chk->sent < SCTP_DATAGRAM_ACKED)) {
@@ -587,7 +570,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
(now.tv_usec > chk->rec.data.timetodrop.tv_usec))) {
/* Yes so drop it */
if (chk->data) {
- sctp_release_pr_sctp_chunk(stcb,
+ (void)sctp_release_pr_sctp_chunk(stcb,
chk,
(SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
&stcb->asoc.sent_queue);
@@ -599,7 +582,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
/* Has it been retransmitted tv_sec times? */
if (chk->snd_count > chk->rec.data.timetodrop.tv_sec) {
if (chk->data) {
- sctp_release_pr_sctp_chunk(stcb,
+ (void)sctp_release_pr_sctp_chunk(stcb,
chk,
(SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
&stcb->asoc.sent_queue);
@@ -678,17 +661,16 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
sctp_log_fr(tsnfirst, tsnlast, num_mk, SCTP_FR_T3_TIMEOUT);
#endif
#ifdef SCTP_DEBUG
- if (sctp_debug_on & SCTP_DEBUG_TIMER1) {
- if (num_mk) {
- printf("LAST TSN marked was %x\n", tsnlast);
- printf("Num marked for retransmission was %d peer-rwd:%ld\n",
- num_mk, (u_long)stcb->asoc.peers_rwnd);
- printf("LAST TSN marked was %x\n", tsnlast);
- printf("Num marked for retransmission was %d peer-rwd:%d\n",
- num_mk,
- (int)stcb->asoc.peers_rwnd
- );
- }
+ if (num_mk) {
+ SCTPDBG(SCTP_DEBUG_TIMER1, "LAST TSN marked was %x\n",
+ tsnlast);
+ SCTPDBG(SCTP_DEBUG_TIMER1, "Num marked for retransmission was %d peer-rwd:%ld\n",
+ num_mk, (u_long)stcb->asoc.peers_rwnd);
+ SCTPDBG(SCTP_DEBUG_TIMER1, "LAST TSN marked was %x\n",
+ tsnlast);
+ SCTPDBG(SCTP_DEBUG_TIMER1, "Num marked for retransmission was %d peer-rwd:%d\n",
+ num_mk,
+ (int)stcb->asoc.peers_rwnd);
}
#endif
*num_marked = num_mk;
@@ -700,7 +682,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
}
if (stcb->asoc.sent_queue_retran_cnt != cnt_mk) {
#ifdef INVARIANTS
- printf("Local Audit says there are %d for retran asoc cnt:%d\n",
+ SCTP_PRINTF("Local Audit says there are %d for retran asoc cnt:%d\n",
cnt_mk, stcb->asoc.sent_queue_retran_cnt);
#endif
#ifndef SCTP_AUDITING_ENABLED
@@ -721,23 +703,17 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
}
}
if (audit_tf) {
-#ifdef SCTP_DEBUG
- if (sctp_debug_on & SCTP_DEBUG_TIMER4) {
- printf("Audit total flight due to negative value net:%p\n",
- net);
- }
-#endif /* SCTP_DEBUG */
+ SCTPDBG(SCTP_DEBUG_TIMER4,
+ "Audit total flight due to negative value net:%p\n",
+ net);
stcb->asoc.total_flight = 0;
stcb->asoc.total_flight_count = 0;
/* Clear all networks flight size */
TAILQ_FOREACH(lnets, &stcb->asoc.nets, sctp_next) {
lnets->flight_size = 0;
-#ifdef SCTP_DEBUG
- if (sctp_debug_on & SCTP_DEBUG_TIMER4) {
- printf("Net:%p c-f cwnd:%d ssthresh:%d\n",
- lnets, lnets->cwnd, lnets->ssthresh);
- }
-#endif /* SCTP_DEBUG */
+ SCTPDBG(SCTP_DEBUG_TIMER4,
+ "Net:%p c-f cwnd:%d ssthresh:%d\n",
+ lnets, lnets->cwnd, lnets->ssthresh);
}
TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) {
if (chk->sent < SCTP_DATAGRAM_RESEND) {
@@ -867,7 +843,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
alt = sctp_find_alternate_net(stcb, net, 0);
}
- sctp_mark_all_for_resend(stcb, net, alt, win_probe, &num_mk);
+ (void)sctp_mark_all_for_resend(stcb, net, alt, win_probe, &num_mk);
/* FR Loss recovery just ended with the T3. */
stcb->asoc.fast_retran_loss_recovery = 0;
@@ -1082,7 +1058,7 @@ sctp_cookie_timer(struct sctp_inpcb *inp,
#ifdef INVARIANTS
panic("Cookie timer expires in wrong state?");
#else
- printf("Strange in state %d not cookie-echoed yet c-e timer expires?\n", SCTP_GET_STATE(&stcb->asoc));
+ SCTP_PRINTF("Strange in state %d not cookie-echoed yet c-e timer expires?\n", SCTP_GET_STATE(&stcb->asoc));
return (0);
#endif
}
@@ -1130,7 +1106,7 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
return (0);
}
/* find the existing STRRESET, we use the seq number we sent out on */
- sctp_find_stream_reset(stcb, stcb->asoc.str_reset_seq_out, &strrst);
+ (void)sctp_find_stream_reset(stcb, stcb->asoc.str_reset_seq_out, &strrst);
if (strrst == NULL) {
return (0);
}
@@ -1222,11 +1198,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
* properly handling the chunk type upper bits Mark
* this peer as ASCONF incapable and cleanup
*/
-#ifdef SCTP_DEBUG
- if (sctp_debug_on & SCTP_DEBUG_TIMER1) {
- printf("asconf_timer: Peer has not responded to our repeated ASCONFs\n");
- }
-#endif /* SCTP_DEBUG */
+ SCTPDBG(SCTP_DEBUG_TIMER1, "asconf_timer: Peer has not responded to our repeated ASCONFs\n");
sctp_asconf_cleanup(stcb, net);
return (0);
}
@@ -1339,7 +1311,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp,
return;
if (stcb->asoc.sent_queue_retran_cnt) {
- printf("Hmm, sent_queue_retran_cnt is non-zero %d\n",
+ SCTP_PRINTF("Hmm, sent_queue_retran_cnt is non-zero %d\n",
stcb->asoc.sent_queue_retran_cnt);
stcb->asoc.sent_queue_retran_cnt = 0;
}
@@ -1356,7 +1328,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp,
}
if (cnt) {
/* yep, we lost a spoke or two */
- printf("Found an additional %d streams NOT on outwheel, corrected\n", cnt);
+ SCTP_PRINTF("Found an additional %d streams NOT on outwheel, corrected\n", cnt);
} else {
/* no spokes lost, */
stcb->asoc.total_output_queue_size = 0;
@@ -1376,7 +1348,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp,
}
}
if (chks_in_queue != stcb->asoc.stream_queue_cnt) {
- printf("Hmm, stream queue cnt at %d I counted %d in stream out wheel\n",
+ SCTP_PRINTF("Hmm, stream queue cnt at %d I counted %d in stream out wheel\n",
stcb->asoc.stream_queue_cnt, chks_in_queue);
}
if (chks_in_queue) {
@@ -1389,12 +1361,12 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp,
* and add fragments allowed
*/
if (being_filled == 0) {
- printf("Still nothing moved %d chunks are stuck\n",
+ SCTP_PRINTF("Still nothing moved %d chunks are stuck\n",
chks_in_queue);
}
}
} else {
- printf("Found no chunks on any queue tot:%lu\n",
+ SCTP_PRINTF("Found no chunks on any queue tot:%lu\n",
(u_long)stcb->asoc.total_output_queue_size);
stcb->asoc.total_output_queue_size = 0;
}
@@ -1544,15 +1516,16 @@ sctp_pathmtu_timer(struct sctp_inpcb *inp,
if ((net->src_addr_selected == 0) ||
(net->ro._s_addr == NULL) ||
(net->ro._s_addr->localifa_flags & SCTP_BEING_DELETED)) {
- if ((net->ro._s_addr == NULL) && (net->ro._s_addr->localifa_flags & SCTP_BEING_DELETED)) {
+ if ((net->ro._s_addr != NULL) && (net->ro._s_addr->localifa_flags & SCTP_BEING_DELETED)) {
sctp_free_ifa(net->ro._s_addr);
net->ro._s_addr = NULL;
net->src_addr_selected = 0;
+ } else if (net->ro._s_addr == NULL) {
+ net->ro._s_addr = sctp_source_address_selection(inp,
+ stcb,
+ (sctp_route_t *) & net->ro,
+ net, 0, stcb->asoc.vrf_id);
}
- net->ro._s_addr = sctp_source_address_selection(inp,
- stcb,
- (sctp_route_t *) & net->ro,
- net, 0, stcb->asoc.vrf_id);
if (net->ro._s_addr)
net->src_addr_selected = 1;
}
@@ -1688,7 +1661,7 @@ select_a_new_ep:
}
if ((it->inp->inp_starting_point_for_iterator != NULL) &&
(it->inp->inp_starting_point_for_iterator != it)) {
- printf("Iterator collision, waiting for one at %p\n",
+ SCTP_PRINTF("Iterator collision, waiting for one at %p\n",
it->inp);
SCTP_INP_WUNLOCK(it->inp);
goto start_timer_return;
OpenPOWER on IntegriCloud