ppp: refresh patches

This commit is contained in:
AmadeusGhost 2020-06-01 23:01:24 +08:00
parent 1a7916883c
commit 9c22de09fa
2 changed files with 25 additions and 28 deletions

View File

@ -9,22 +9,21 @@
#ifdef CHAPMS #ifdef CHAPMS
#include "chap_ms.h" #include "chap_ms.h"
#define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5) #define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5)
@@ -492,6 +494,19 @@ chap_respond(struct chap_client_state *c @@ -481,6 +483,18 @@ chap_respond(struct chap_client_state *cs, int id,
p[2] = len >> 8; p[2] = len >> 8;
p[3] = len; p[3] = len;
+ if (npppd > 1) { + if (npppd > 1) {
+ if (syncppp(npppd) < 0) { + if (syncppp(npppd) < 0) {
+ error("syncppp sync fail"); + error("syncppp sync fail");
+ sem_unlink(SEM_COUNT_NAME); + sem_unlink(SEM_COUNT_NAME);
+ sem_unlink(SEM_BLOCK_NAME); + sem_unlink(SEM_BLOCK_NAME);
+ } else { + } else {
+ info("syncppp sync succeeded"); + info("syncppp sync succeeded");
+ } + }
+ } else { + } else {
+ info("syncppp not active"); + info("syncppp not active");
+ } + }
+
+ +
output(0, response, PPP_HDRLEN + len); output(0, response, PPP_HDRLEN + len);
} }
@ -55,39 +54,38 @@
# CC = gcc # CC = gcc
# #
COPTS = -O2 -pipe -Wall -g COPTS = -O2 -pipe -Wall -g
-LIBS = -LIBS = -lrt
+LIBS = -lpthread +LIBS = -lpthread
# Uncomment the next line to include support for Microsoft's # Uncomment the next line to include support for Microsoft's
# MS-CHAP authentication protocol. Also, edit plugins/radius/Makefile.linux. # MS-CHAP authentication protocol. Also, edit plugins/radius/Makefile.linux.
--- a/pppd/options.c --- a/pppd/options.c
+++ b/pppd/options.c +++ b/pppd/options.c
@@ -128,6 +128,7 @@ bool dump_options; /* print out option @@ -123,6 +123,7 @@ bool dump_options; /* print out option values */
bool dryrun; /* print out option values and exit */ bool dryrun; /* print out option values and exit */
char *domain; /* domain name set by domain option */ char *domain; /* domain name set by domain option */
int child_wait = 5; /* # seconds to wait for children at exit */ int child_wait = 5; /* # seconds to wait for children at exit */
+int npppd = 0; /* synchronize between multiple pppd */ +int npppd = 0; /* synchronize between multiple pppd */
struct userenv *userenv_list; /* user environment variables */ struct userenv *userenv_list; /* user environment variables */
int dfl_route_metric = -1; /* metric of the default route to set over the PPP link */ int dfl_route_metric = -1; /* metric of the default route to set over the PPP link */
@@ -342,6 +343,10 @@ option_t general_options[] = { @@ -312,6 +313,9 @@ option_t general_options[] = {
"Set pathname of ipv6-down script", "Unset user environment variable",
OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, OPT_A2PRINTER | OPT_NOPRINT, (void *)user_unsetprint },
+ { "syncppp", o_int, &npppd, + { "syncppp", o_int, &npppd,
+ "sync among multiple pppd when sending chap/pap respond", OPT_PRIO }, + "sync among multiple pppd when sending chap/pap respond", OPT_PRIO },
+ +
+ { "defaultroute-metric", o_int, &dfl_route_metric,
#ifdef HAVE_MULTILINK "Metric to use for the default route (Linux only; -1 for default behavior)",
{ "multilink", o_bool, &multilink, OPT_PRIV|OPT_LLIMIT|OPT_INITONLY, NULL, 0, -1 },
"Enable multilink operation", OPT_PRIO | 1 },
--- a/pppd/pppd.h --- a/pppd/pppd.h
+++ b/pppd/pppd.h +++ b/pppd/pppd.h
@@ -343,6 +343,7 @@ extern char *bundle_name; /* bundle name @@ -341,6 +341,7 @@ extern char *bundle_name; /* bundle name for multilink */
extern bool dump_options; /* print out option values */ extern bool dump_options; /* print out option values */
extern bool dryrun; /* check everything, print options, exit */ extern bool dryrun; /* check everything, print options, exit */
extern int child_wait; /* # seconds to wait for children at end */ extern int child_wait; /* # seconds to wait for children at end */
+extern int npppd; /* synchronize between multiple pppd */ +extern int npppd; /* synchronize between multiple pppd */
#ifdef MAXOCTETS #ifdef MAXOCTETS
extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */ extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */
@ -199,9 +197,8 @@
+ } + }
+ } else { + } else {
+ info("syncppp not active"); + info("syncppp not active");
+ } + }
+ +
output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN); output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
TIMEOUT(upap_timeout, u, u->us_timeouttime); TIMEOUT(upap_timeout, u, u->us_timeouttime);

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 = -lrt LIBS = -lpthread
-# 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