3 Copyright 2003, CyberTAN Inc. All Rights Reserved
5 THIS SOFTWARE IS OFFERED "AS IS", AND CYBERTAN GRANTS NO WARRANTIES OF ANY
6 KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. CYBERTAN
7 SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8 FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE
13 Copyright 2005, Broadcom Corporation
16 THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
17 KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
18 SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
19 FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
25 #include <sys/ioctl.h>
29 // used in keepalive mode (ppp_demand=0)
32 int start_redial(void)
42 while (killall("redial", SIGKILL
) == 0) {
48 int redial_main(int argc
, char **argv
)
54 proto
= get_wan_proto();
55 if (proto
== WP_PPPOE
|| proto
== WP_PPP3G
|| proto
== WP_PPTP
|| proto
== WP_L2TP
) {
56 if (nvram_get_int("ppp_demand") != 0) return 0;
59 tm
= nvram_get_int("ppp_redialperiod") ? : 30;
62 syslog(LOG_INFO
, "Started. Time: %d", tm
);
70 if (!check_wanup()) break;
76 if ((count
< 3) && (get_wan_proto() == WP_PPPOE
) || (get_wan_proto() == WP_PPP3G
)) {
77 if (f_read("/var/lib/misc/pppoe-disc", &ut
, sizeof(ut
)) == sizeof(ut
)) {
78 ut
= (get_uptime() - ut
);
80 syslog(LOG_INFO
, "PPPoE reconnect in progress (%ld)", ut
);
88 if ((!wait_action_idle(10)) || (check_wanup())) continue;
90 if (!nvram_match("action_service", "wan-restart")) {
91 syslog(LOG_INFO
, "WAN down. Reconnecting...");
92 xstart("service", "wan", "restart");
96 syslog(LOG_INFO
, "WAN down. Reconnect is already in progress...");