static declaration of conf_echo_timeout = 60 in ppp_lcp.c

Bug reports
Post Reply
vaibhav
Posts: 3
Joined: 05 Jul 2018, 09:52

static declaration of conf_echo_timeout = 60 in ppp_lcp.c

Post by vaibhav »

++lcp->echo_sent;
log_ppp_warn("lcp: lcp->echo_sent == %d; conf_echo_failure == %d\n", lcp->echo_sent, conf_echo_failure);

ap_session_read_stats(&lcp->ppp->ses, &stats);

if (conf_echo_timeout) {
if (lcp->echo_sent == 2) {
lcp->last_ipackets = stats.rx_packets;
lcp->last_echo_ts = _time();
} else if (lcp->echo_sent > 2) {
ts = _time();
if (lcp->last_ipackets != stats.rx_packets) {
lcp->echo_sent = 1;
lcp_update_echo_timer(lcp);
} else if (ts - lcp->last_echo_ts > conf_echo_timeout) {
f = 1;
} else if (t->period > 3000) {
t->period = 0.8 * t->period;
triton_timer_mod(t, 0);
}
}
} else if (lcp->echo_sent > conf_echo_failure)
f = 1;

if (f) {
log_ppp_warn("lcp: no echo reply\n");
ap_session_terminate(&lcp->ppp->ses, TERM_LOST_CARRIER, 1);
return;

In the above code "if (conf_echo_timeout)" condition remains always true as there is "static int conf_echo_timeout = 60;" declaration in the start of file. As per the logic in above code snippet, if lcp-echo-timeout option is not used then the server should send lcp-echo-failure number of ECHO REQUEST packets before terminating the session. But, this "static int conf_echo_timeout = 60;" declaration is causing the "if (conf_echo_timeout)" to never fail and hence, "else if (lcp->echo_sent > conf_echo_failure)
f = 1;" is never executed.
Post Reply