From 5efd40cf3be955aa2857c61be759299ca238dda2 Mon Sep 17 00:00:00 2001 From: "[anp/hsw]" Date: Mon, 30 Dec 2024 12:21:55 +0700 Subject: [PATCH] disable holdoff for reconnect on timeout or link failure (#538) Signed-off-by: [anp/hsw] --- pppd/auth.c | 1 + pppd/main.c | 5 ++++- pppd/pppd.8 | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pppd/auth.c b/pppd/auth.c index a8fd1e6..a78a697 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -1325,6 +1325,7 @@ connect_time_expired(void *arg) info("Connect time expired"); ppp_set_status(EXIT_CONNECT_TIME); lcp_close(0, "Connect time expired"); /* Close connection */ + need_holdoff = 0; } /* diff --git a/pppd/main.c b/pppd/main.c index 32ad489..3b3fc45 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -607,8 +607,10 @@ main(int argc, char *argv[]) while (phase != PHASE_DEAD) { handle_events(); get_input(); - if (kill_link) + if (kill_link) { lcp_close(0, "User request"); + need_holdoff = 0; + } if (asked_to_quit) { bundle_terminating = 1; if (phase == PHASE_MASTER) @@ -1149,6 +1151,7 @@ get_input(void) notice("Modem hangup"); hungup = 1; code = EXIT_HANGUP; + need_holdoff = 0; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); return; diff --git a/pppd/pppd.8 b/pppd/pppd.8 index d2c88e3..3a787a0 100644 --- a/pppd/pppd.8 +++ b/pppd/pppd.8 @@ -475,7 +475,8 @@ exclude the password string from the log. This is the default. Specifies how many seconds to wait before re-initiating the link after it terminates. This option only has any effect if the \fIpersist\fR or \fIdemand\fR option is used. The holdoff period is not applied if -the link was terminated because it was idle. +the link was terminated because it was idle, connect time expired, +modem hangup or user request. .TP .B idle \fIn Specifies that pppd should disconnect if the link is idle for \fIn\fR -- 2.39.5