1 diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
2 --- ppp-2.4.4.orig/pppd/main.c 2009-05-07 22:25:24.000000000 -0400
3 +++ ppp-2.4.4/pppd/main.c 2009-05-07 22:22:40.000000000 -0400
5 #include <sys/socket.h>
6 #include <netinet/in.h>
8 +#include <sys/sysinfo.h>
14 /* Prototypes for procedures local to this file. */
16 +static void check_time(void);
17 static void setup_signals __P((void));
18 static void create_pidfile __P((int pid));
19 static void create_linkpidfile __P((int pid));
21 info("Starting link");
25 gettimeofday(&start_time, NULL);
26 script_unsetenv("CONNECT_TIME");
27 script_unsetenv("BYTES_SENT");
28 @@ -1264,6 +1267,36 @@
30 static struct callout *callout = NULL; /* Callout list */
31 static struct timeval timenow; /* Current time */
32 +static long uptime_diff = 0;
33 +static int uptime_diff_set = 0;
35 +static void check_time(void)
42 + gettimeofday(&t, NULL);
44 + new_diff = t.tv_sec - i.uptime;
46 + if (!uptime_diff_set) {
47 + uptime_diff = new_diff;
48 + uptime_diff_set = 1;
52 + if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) {
53 + /* system time has changed, update counters and timeouts */
54 + info("System time change detected.");
55 + start_time.tv_sec += new_diff - uptime_diff;
57 + for (p = callout; p != NULL; p = p->c_next)
58 + p->c_time.tv_sec += new_diff - uptime_diff;
60 + uptime_diff = new_diff;
64 * timeout - Schedule a timeout.
71 while (callout != NULL) {
81 gettimeofday(&timenow, NULL);
82 tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec;