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;
83 diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
84 --- ppp-2.4.4.orig/pppd/main.c 2009-05-07 22:25:24.000000000 -0400
85 +++ ppp-2.4.4/pppd/main.c 2009-05-07 22:22:40.000000000 -0400
87 #include <sys/socket.h>
88 #include <netinet/in.h>
89 #include <arpa/inet.h>
90 +#include <sys/sysinfo.h>
96 /* Prototypes for procedures local to this file. */
98 +static void check_time(void);
99 static void setup_signals __P((void));
100 static void create_pidfile __P((int pid));
101 static void create_linkpidfile __P((int pid));
103 info("Starting link");
107 gettimeofday(&start_time, NULL);
108 script_unsetenv("CONNECT_TIME");
109 script_unsetenv("BYTES_SENT");
110 @@ -1264,6 +1267,36 @@
112 static struct callout *callout = NULL; /* Callout list */
113 static struct timeval timenow; /* Current time */
114 +static long uptime_diff = 0;
115 +static int uptime_diff_set = 0;
117 +static void check_time(void)
124 + gettimeofday(&t, NULL);
126 + new_diff = t.tv_sec - i.uptime;
128 + if (!uptime_diff_set) {
129 + uptime_diff = new_diff;
130 + uptime_diff_set = 1;
134 + if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) {
135 + /* system time has changed, update counters and timeouts */
136 + info("System time change detected.");
137 + start_time.tv_sec += new_diff - uptime_diff;
139 + for (p = callout; p != NULL; p = p->c_next)
140 + p->c_time.tv_sec += new_diff - uptime_diff;
142 + uptime_diff = new_diff;
146 * timeout - Schedule a timeout.
147 @@ -1334,6 +1367,8 @@
153 while (callout != NULL) {
156 @@ -1361,6 +1396,8 @@
163 gettimeofday(&timenow, NULL);
164 tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec;