ppp: update to version 2.4.8.git-2020-05-25

ddd57c2 pppd: Add lcp-echo-adaptive option
c319558 pppd: Handle SIGINT and SIGTERM during interrupted syscalls (#148)
0bc11fb Added missing options to manual pages. (#149)
b1fcf16 Merge branch 'monotonic-time' of https://github.com/themiron/ppp
c78e312 pppd: linux: use monotonic time if possible

Remove patch 121-debian_adaptive_lcp_echo as patch is upstream accepted
Remove patch 206-compensate_time_change.patch as timewrap issues are
solved by a patch making use of monotonic time

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
This commit is contained in:
Hans Dedecker 2020-05-31 20:28:06 +02:00
parent b017a016cc
commit 8d2c031f21
11 changed files with 20 additions and 170 deletions

View File

@ -13,9 +13,9 @@ PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/paulusmack/ppp PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
PKG_SOURCE_DATE:=2020-03-21 PKG_SOURCE_DATE:=2020-05-25
PKG_SOURCE_VERSION:=41a73232c16e9a063cfe3fad461c94af3f450f6c PKG_SOURCE_VERSION:=ddd57c279f467e18c4fb3a661f21a069a5a37a1f
PKG_MIRROR_HASH:=7b966003b7c1bec95156159119b52583778405f0229dc7590911fa93f031552b PKG_MIRROR_HASH:=aac65e65dd25eaf8978a7a0b3258c863d90e29e247dd33d95276c0c189bcd424
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=BSD-4-Clause PKG_LICENSE:=BSD-4-Clause
PKG_CPE_ID:=cpe:/a:samba:ppp PKG_CPE_ID:=cpe:/a:samba:ppp

View File

@ -85,7 +85,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
"Enable multilink operation", OPT_PRIO | 1 }, "Enable multilink operation", OPT_PRIO | 1 },
--- a/pppd/pppd.h --- a/pppd/pppd.h
+++ b/pppd/pppd.h +++ b/pppd/pppd.h
@@ -334,6 +334,8 @@ extern int connect_delay; /* Time to del @@ -335,6 +335,8 @@ extern int connect_delay; /* Time to del
extern int max_data_rate; /* max bytes/sec through charshunt */ extern int max_data_rate; /* max bytes/sec through charshunt */
extern int req_unit; /* interface unit number to use */ extern int req_unit; /* interface unit number to use */
extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */ extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */

View File

@ -161,7 +161,7 @@
} else { } else {
--- a/pppd/pppd.h --- a/pppd/pppd.h
+++ b/pppd/pppd.h +++ b/pppd/pppd.h
@@ -601,7 +601,7 @@ void demand_conf __P((void)); /* config @@ -602,7 +602,7 @@ void demand_conf __P((void)); /* config
void demand_block __P((void)); /* set all NPs to queue up packets */ void demand_block __P((void)); /* set all NPs to queue up packets */
void demand_unblock __P((void)); /* set all NPs to pass packets */ void demand_unblock __P((void)); /* set all NPs to pass packets */
void demand_discard __P((void)); /* set all NPs to discard packets */ void demand_discard __P((void)); /* set all NPs to discard packets */

View File

@ -137,7 +137,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
.B disconnect \fIscript .B disconnect \fIscript
Execute the command specified by \fIscript\fR, by passing it to a Execute the command specified by \fIscript\fR, by passing it to a
shell, after shell, after
@@ -746,7 +751,12 @@ disable both forms of hardware flow cont @@ -751,7 +756,12 @@ disable both forms of hardware flow cont
.TP .TP
.B nodefaultroute .B nodefaultroute
Disable the \fIdefaultroute\fR option. The system administrator who Disable the \fIdefaultroute\fR option. The system administrator who
@ -153,7 +153,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
.B nodefaultroute6 .B nodefaultroute6
--- a/pppd/pppd.h --- a/pppd/pppd.h
+++ b/pppd/pppd.h +++ b/pppd/pppd.h
@@ -683,7 +683,7 @@ int sif6addr __P((int, eui64_t, eui64_t @@ -684,7 +684,7 @@ int sif6addr __P((int, eui64_t, eui64_t
int cif6addr __P((int, eui64_t, eui64_t)); int cif6addr __P((int, eui64_t, eui64_t));
/* Remove an IPv6 address from i/f */ /* Remove an IPv6 address from i/f */
#endif #endif
@ -292,7 +292,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
} }
--- a/pppd/sys-solaris.c --- a/pppd/sys-solaris.c
+++ b/pppd/sys-solaris.c +++ b/pppd/sys-solaris.c
@@ -2119,12 +2119,18 @@ cifaddr(u, o, h) @@ -2120,12 +2120,18 @@ cifaddr(u, o, h)
* sifdefaultroute - assign a default route through the address given. * sifdefaultroute - assign a default route through the address given.
*/ */
int int

View File

@ -84,7 +84,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
} }
--- a/pppd/pppd.h --- a/pppd/pppd.h
+++ b/pppd/pppd.h +++ b/pppd/pppd.h
@@ -336,6 +336,8 @@ extern int req_unit; /* interface unit n @@ -337,6 +337,8 @@ extern int req_unit; /* interface unit n
extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */ extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */
extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */ extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */

View File

@ -1,56 +0,0 @@
--- a/pppd/lcp.c
+++ b/pppd/lcp.c
@@ -72,6 +72,7 @@ static void lcp_delayed_up __P((void *))
*/
int lcp_echo_interval = 0; /* Interval between LCP echo-requests */
int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */
+bool lcp_echo_adaptive = 0; /* request echo only if the link was idle */
bool lax_recv = 0; /* accept control chars in asyncmap */
bool noendpoint = 0; /* don't send/accept endpoint discriminator */
@@ -150,6 +151,8 @@ static option_t lcp_option_list[] = {
OPT_PRIO },
{ "lcp-echo-interval", o_int, &lcp_echo_interval,
"Set time in seconds between LCP echo requests", OPT_PRIO },
+ { "lcp-echo-adaptive", o_bool, &lcp_echo_adaptive,
+ "Suppress LCP echo requests if traffic was received", 1 },
{ "lcp-restart", o_int, &lcp_fsm[0].timeouttime,
"Set time in seconds between LCP retransmissions", OPT_PRIO },
{ "lcp-max-terminate", o_int, &lcp_fsm[0].maxtermtransmits,
@@ -2330,6 +2333,22 @@ LcpSendEchoRequest (f)
}
}
+ /*
+ * If adaptive echos have been enabled, only send the echo request if
+ * no traffic was received since the last one.
+ */
+ if (lcp_echo_adaptive) {
+ static unsigned int last_pkts_in = 0;
+
+ update_link_stats(f->unit);
+ link_stats_valid = 0;
+
+ if (link_stats.pkts_in != last_pkts_in) {
+ last_pkts_in = link_stats.pkts_in;
+ return;
+ }
+ }
+
/*
* Make and send the echo request frame.
*/
--- a/pppd/pppd.8
+++ b/pppd/pppd.8
@@ -575,6 +575,11 @@ to 1) if the \fIproxyarp\fR option is us
dynamic IP address option (i.e. set /proc/sys/net/ipv4/ip_dynaddr to
1) in demand mode if the local address changes.
.TP
+.B lcp\-echo\-adaptive
+If this option is used with the \fIlcp\-echo\-failure\fR option then
+pppd will send LCP echo\-request frames only if no traffic was received
+from the peer since the last echo\-request was sent.
+.TP
.B lcp\-echo\-failure \fIn
If this option is given, pppd will presume the peer to be dead
if \fIn\fR LCP echo\-requests are sent without receiving a valid LCP

View File

@ -1,94 +0,0 @@
pppd: Watch out for time warps
On many embedded systems there is no battery backed RTC and a proper system
time only becomes available through NTP after establishing a connection.
When the clock suddenly jumps forward, the internal accounting (connect time)
is confused resulting in unreliable data.
This patch implements periodic clock checking to look for time warps, if one
is detected, the internal counters are adjusted accordingly.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -89,6 +89,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sys/sysinfo.h>
#include "pppd.h"
#include "magic.h"
@@ -226,6 +227,7 @@ static struct subprocess *children;
/* Prototypes for procedures local to this file. */
+static void check_time(void);
static void setup_signals __P((void));
static void create_pidfile __P((int pid));
static void create_linkpidfile __P((int pid));
@@ -525,6 +527,7 @@ main(argc, argv)
info("Starting link");
}
+ check_time();
gettimeofday(&start_time, NULL);
script_unsetenv("CONNECT_TIME");
script_unsetenv("BYTES_SENT");
@@ -1274,6 +1277,36 @@ struct callout {
static struct callout *callout = NULL; /* Callout list */
static struct timeval timenow; /* Current time */
+static long uptime_diff = 0;
+static int uptime_diff_set = 0;
+
+static void check_time(void)
+{
+ long new_diff;
+ struct timeval t;
+ struct sysinfo i;
+ struct callout *p;
+
+ gettimeofday(&t, NULL);
+ sysinfo(&i);
+ new_diff = t.tv_sec - i.uptime;
+
+ if (!uptime_diff_set) {
+ uptime_diff = new_diff;
+ uptime_diff_set = 1;
+ return;
+ }
+
+ if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) {
+ /* system time has changed, update counters and timeouts */
+ info("System time change detected.");
+ start_time.tv_sec += new_diff - uptime_diff;
+
+ for (p = callout; p != NULL; p = p->c_next)
+ p->c_time.tv_sec += new_diff - uptime_diff;
+ }
+ uptime_diff = new_diff;
+}
/*
* timeout - Schedule a timeout.
@@ -1344,6 +1377,8 @@ calltimeout()
{
struct callout *p;
+ check_time();
+
while (callout != NULL) {
p = callout;
@@ -1371,6 +1406,8 @@ timeleft(tvp)
{
if (callout == NULL)
return NULL;
+
+ check_time();
gettimeofday(&timenow, NULL);
tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec;

View File

@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/main.c --- a/pppd/main.c
+++ b/pppd/main.c +++ b/pppd/main.c
@@ -1055,7 +1055,8 @@ get_input() @@ -1052,7 +1052,8 @@ get_input()
} }
notice("Modem hangup"); notice("Modem hangup");
hungup = 1; hungup = 1;

View File

@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/pppd.h --- a/pppd/pppd.h
+++ b/pppd/pppd.h +++ b/pppd/pppd.h
@@ -325,7 +325,6 @@ extern int holdoff; /* Dead time before @@ -326,7 +326,6 @@ extern int holdoff; /* Dead time before
extern bool holdoff_specified; /* true if user gave a holdoff value */ extern bool holdoff_specified; /* true if user gave a holdoff value */
extern bool notty; /* Stdin/out is not a tty */ extern bool notty; /* Stdin/out is not a tty */
extern char *pty_socket; /* Socket to connect to pty */ extern char *pty_socket; /* Socket to connect to pty */

View File

@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/main.c --- a/pppd/main.c
+++ b/pppd/main.c +++ b/pppd/main.c
@@ -886,14 +886,17 @@ struct protocol_list { @@ -883,14 +883,17 @@ struct protocol_list {
const char *name; const char *name;
} protocol_list[] = { } protocol_list[] = {
{ 0x21, "IP" }, { 0x21, "IP" },
@ -25,7 +25,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x33, "Stream Protocol ST-II" }, { 0x33, "Stream Protocol ST-II" },
{ 0x35, "Banyan Vines" }, { 0x35, "Banyan Vines" },
{ 0x39, "AppleTalk EDDP" }, { 0x39, "AppleTalk EDDP" },
@@ -907,8 +910,11 @@ struct protocol_list { @@ -904,8 +907,11 @@ struct protocol_list {
{ 0x49, "Serial Data Transport Protocol (PPP-SDTP)" }, { 0x49, "Serial Data Transport Protocol (PPP-SDTP)" },
{ 0x4b, "SNA over 802.2" }, { 0x4b, "SNA over 802.2" },
{ 0x4d, "SNA" }, { 0x4d, "SNA" },
@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x53, "Encryption" }, { 0x53, "Encryption" },
{ 0x55, "Individual Link Encryption" }, { 0x55, "Individual Link Encryption" },
{ 0x57, "IPv6" }, { 0x57, "IPv6" },
@@ -919,12 +925,15 @@ struct protocol_list { @@ -916,12 +922,15 @@ struct protocol_list {
{ 0x65, "RTP IPHC Compressed non-TCP" }, { 0x65, "RTP IPHC Compressed non-TCP" },
{ 0x67, "RTP IPHC Compressed UDP 8" }, { 0x67, "RTP IPHC Compressed UDP 8" },
{ 0x69, "RTP IPHC Compressed RTP 8" }, { 0x69, "RTP IPHC Compressed RTP 8" },
@ -53,7 +53,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x0203, "IBM Source Routing BPDU" }, { 0x0203, "IBM Source Routing BPDU" },
{ 0x0205, "DEC LANBridge100 Spanning Tree" }, { 0x0205, "DEC LANBridge100 Spanning Tree" },
{ 0x0207, "Cisco Discovery Protocol" }, { 0x0207, "Cisco Discovery Protocol" },
@@ -936,15 +945,19 @@ struct protocol_list { @@ -933,15 +942,19 @@ struct protocol_list {
{ 0x0231, "Luxcom" }, { 0x0231, "Luxcom" },
{ 0x0233, "Sigma Network Systems" }, { 0x0233, "Sigma Network Systems" },
{ 0x0235, "Apple Client Server Protocol" }, { 0x0235, "Apple Client Server Protocol" },
@ -73,7 +73,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x4001, "Cray Communications Control Protocol" }, { 0x4001, "Cray Communications Control Protocol" },
{ 0x4003, "CDPD Mobile Network Registration Protocol" }, { 0x4003, "CDPD Mobile Network Registration Protocol" },
{ 0x4005, "Expand accelerator protocol" }, { 0x4005, "Expand accelerator protocol" },
@@ -955,8 +968,10 @@ struct protocol_list { @@ -952,8 +965,10 @@ struct protocol_list {
{ 0x4023, "RefTek Protocol" }, { 0x4023, "RefTek Protocol" },
{ 0x4025, "Fibre Channel" }, { 0x4025, "Fibre Channel" },
{ 0x4027, "EMIT Protocols" }, { 0x4027, "EMIT Protocols" },
@ -84,7 +84,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x8023, "OSI Network Layer Control Protocol" }, { 0x8023, "OSI Network Layer Control Protocol" },
{ 0x8025, "Xerox NS IDP Control Protocol" }, { 0x8025, "Xerox NS IDP Control Protocol" },
{ 0x8027, "DECnet Phase IV Control Protocol" }, { 0x8027, "DECnet Phase IV Control Protocol" },
@@ -965,7 +980,9 @@ struct protocol_list { @@ -962,7 +977,9 @@ struct protocol_list {
{ 0x8031, "Bridging NCP" }, { 0x8031, "Bridging NCP" },
{ 0x8033, "Stream Protocol Control Protocol" }, { 0x8033, "Stream Protocol Control Protocol" },
{ 0x8035, "Banyan Vines Control Protocol" }, { 0x8035, "Banyan Vines Control Protocol" },
@ -94,7 +94,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x803f, "NETBIOS Framing Control Protocol" }, { 0x803f, "NETBIOS Framing Control Protocol" },
{ 0x8041, "Cisco Systems Control Protocol" }, { 0x8041, "Cisco Systems Control Protocol" },
{ 0x8043, "Ascom Timeplex" }, { 0x8043, "Ascom Timeplex" },
@@ -974,18 +991,24 @@ struct protocol_list { @@ -971,18 +988,24 @@ struct protocol_list {
{ 0x8049, "Serial Data Control Protocol (PPP-SDCP)" }, { 0x8049, "Serial Data Control Protocol (PPP-SDCP)" },
{ 0x804b, "SNA over 802.2 Control Protocol" }, { 0x804b, "SNA over 802.2 Control Protocol" },
{ 0x804d, "SNA Control Protocol" }, { 0x804d, "SNA Control Protocol" },
@ -119,7 +119,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x8207, "Cisco Discovery Protocol Control" }, { 0x8207, "Cisco Discovery Protocol Control" },
{ 0x8209, "Netcs Twin Routing" }, { 0x8209, "Netcs Twin Routing" },
{ 0x820b, "STP - Control Protocol" }, { 0x820b, "STP - Control Protocol" },
@@ -994,24 +1017,29 @@ struct protocol_list { @@ -991,24 +1014,29 @@ struct protocol_list {
{ 0x8281, "MPLSCP" }, { 0x8281, "MPLSCP" },
{ 0x8285, "IEEE p1284.4 standard - Protocol Control" }, { 0x8285, "IEEE p1284.4 standard - Protocol Control" },
{ 0x8287, "ETSI TETRA TNP1 Control Protocol" }, { 0x8287, "ETSI TETRA TNP1 Control Protocol" },

View File

@ -17,7 +17,7 @@ This reverts commit 3c7b86229f7bd2600d74db14b1fe5b3896be3875.
+++ b/pppd/Makefile.linux +++ b/pppd/Makefile.linux
@@ -35,10 +35,10 @@ endif @@ -35,10 +35,10 @@ endif
COPTS = -O2 -pipe -Wall -g COPTS = -O2 -pipe -Wall -g
LIBS = LIBS = -lrt
-# Uncomment the next line to include support for Microsoft's -# Uncomment the next line to include support for Microsoft's
+# Uncomment the next 2 lines to include support for Microsoft's +# Uncomment the next 2 lines to include support for Microsoft's