1 Index: ppp-2.4.3/pppd/main.c
2 ===================================================================
3 --- ppp-2.4.3.orig/pppd/main.c 2007-06-04 13:22:13.340827168 +0200
4 +++ ppp-2.4.3/pppd/main.c 2007-06-04 13:22:13.755764088 +0200
6 #include <sys/socket.h>
7 #include <netinet/in.h>
9 +#include <sys/sysinfo.h>
15 /* Prototypes for procedures local to this file. */
17 +static void check_time(void);
18 static void setup_signals __P((void));
19 static void create_pidfile __P((int pid));
20 static void create_linkpidfile __P((int pid));
22 info("Starting link");
26 gettimeofday(&start_time, NULL);
27 script_unsetenv("CONNECT_TIME");
28 script_unsetenv("BYTES_SENT");
29 @@ -1195,6 +1198,36 @@
31 static struct callout *callout = NULL; /* Callout list */
32 static struct timeval timenow; /* Current time */
33 +static long uptime_diff = 0;
34 +static int uptime_diff_set = 0;
36 +static void check_time(void)
43 + gettimeofday(&t, NULL);
45 + new_diff = t.tv_sec - i.uptime;
47 + if (!uptime_diff_set) {
48 + uptime_diff = new_diff;
49 + uptime_diff_set = 1;
53 + if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) {
54 + /* system time has changed, update counters and timeouts */
55 + info("System time change detected.");
56 + start_time.tv_sec += new_diff - uptime_diff;
58 + for (p = callout; p != NULL; p = p->c_next)
59 + p->c_time.tv_sec += new_diff - uptime_diff;
61 + uptime_diff = new_diff;
65 * timeout - Schedule a timeout.
72 while (callout != NULL) {
82 gettimeofday(&timenow, NULL);
83 tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec;