MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_threshold_management

Function sctp_threshold_management

freebsd/netinet/sctp_timer.c:89–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89static int
90sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
91 struct sctp_nets *net, uint16_t threshold)
92{
93 if (net) {
94 net->error_count++;
95 SCTPDBG(SCTP_DEBUG_TIMER4, "Error count for %p now %d thresh:%d\n",
96 (void *)net, net->error_count,
97 net->failure_threshold);
98 if (net->error_count > net->failure_threshold) {
99 /* We had a threshold failure */
100 if (net->dest_state & SCTP_ADDR_REACHABLE) {
101 net->dest_state &= ~SCTP_ADDR_REACHABLE;
102 net->dest_state &= ~SCTP_ADDR_REQ_PRIMARY;
103 net->dest_state &= ~SCTP_ADDR_PF;
104 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN,
105 stcb, 0,
106 (void *)net, SCTP_SO_NOT_LOCKED);
107 }
108 } else if ((net->pf_threshold < net->failure_threshold) &&
109 (net->error_count > net->pf_threshold)) {
110 if (!(net->dest_state & SCTP_ADDR_PF)) {
111 net->dest_state |= SCTP_ADDR_PF;
112 net->last_active = sctp_get_tick_count();
113 sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED);
114 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT,
115 inp, stcb, net,
116 SCTP_FROM_SCTP_TIMER + SCTP_LOC_1);
117 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
118 }
119 }
120 }
121 if (stcb == NULL)
122 return (0);
123
124 if (net) {
125 if ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) {
126 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
127 sctp_misc_ints(SCTP_THRESHOLD_INCR,
128 stcb->asoc.overall_error_count,
129 (stcb->asoc.overall_error_count + 1),
130 SCTP_FROM_SCTP_TIMER,
131 __LINE__);
132 }
133 stcb->asoc.overall_error_count++;
134 }
135 } else {
136 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
137 sctp_misc_ints(SCTP_THRESHOLD_INCR,
138 stcb->asoc.overall_error_count,
139 (stcb->asoc.overall_error_count + 1),
140 SCTP_FROM_SCTP_TIMER,
141 __LINE__);
142 }
143 stcb->asoc.overall_error_count++;
144 }
145 SCTPDBG(SCTP_DEBUG_TIMER4, "Overall error count for %p now %d thresh:%u state:%x\n",
146 (void *)&stcb->asoc, stcb->asoc.overall_error_count,

Callers 8

sctp_t3rxt_timerFunction · 0.85
sctp_t1init_timerFunction · 0.85
sctp_cookie_timerFunction · 0.85
sctp_strreset_timerFunction · 0.85
sctp_asconf_timerFunction · 0.85
sctp_shutdown_timerFunction · 0.85
sctp_shutdownack_timerFunction · 0.85
sctp_heartbeat_timerFunction · 0.85

Calls 7

sctp_ulp_notifyFunction · 0.85
sctp_send_hbFunction · 0.85
sctp_timer_stopFunction · 0.85
sctp_timer_startFunction · 0.85
sctp_misc_intsFunction · 0.85
sctp_generate_causeFunction · 0.85

Tested by

no test coverage detected