2012-06-19 17:03:24 +00:00
|
|
|
pppd: Allow specifying ip-up and ip-down scripts
|
|
|
|
|
|
|
|
This patch implements the "ip-up-script" and "ip-down-script" options which
|
|
|
|
allow to specify the path of the ip-up and ip-down scripts to call.
|
|
|
|
|
|
|
|
These options default to _PATH_IPUP and _PATH_IPDOWN to retain the
|
|
|
|
existing behaviour.
|
|
|
|
|
|
|
|
The patch originated from the Debian project.
|
|
|
|
|
2016-06-07 09:42:32 +00:00
|
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
2012-06-19 17:03:24 +00:00
|
|
|
|
2009-05-21 10:49:21 +00:00
|
|
|
--- a/pppd/ipcp.c
|
|
|
|
+++ b/pppd/ipcp.c
|
2014-06-15 20:55:17 +00:00
|
|
|
@@ -1958,7 +1958,7 @@ ipcp_up(f)
|
2009-05-20 22:36:38 +00:00
|
|
|
*/
|
|
|
|
if (ipcp_script_state == s_down && ipcp_script_pid == 0) {
|
|
|
|
ipcp_script_state = s_up;
|
|
|
|
- ipcp_script(_PATH_IPUP, 0);
|
|
|
|
+ ipcp_script(path_ipup, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-15 20:55:17 +00:00
|
|
|
@@ -2008,7 +2008,7 @@ ipcp_down(f)
|
2009-05-20 22:36:38 +00:00
|
|
|
/* Execute the ip-down script */
|
|
|
|
if (ipcp_script_state == s_up && ipcp_script_pid == 0) {
|
|
|
|
ipcp_script_state = s_down;
|
|
|
|
- ipcp_script(_PATH_IPDOWN, 0);
|
|
|
|
+ ipcp_script(path_ipdown, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-15 20:55:17 +00:00
|
|
|
@@ -2062,13 +2062,13 @@ ipcp_script_done(arg)
|
2009-05-20 22:36:38 +00:00
|
|
|
case s_up:
|
|
|
|
if (ipcp_fsm[0].state != OPENED) {
|
|
|
|
ipcp_script_state = s_down;
|
|
|
|
- ipcp_script(_PATH_IPDOWN, 0);
|
|
|
|
+ ipcp_script(path_ipdown, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case s_down:
|
|
|
|
if (ipcp_fsm[0].state == OPENED) {
|
|
|
|
ipcp_script_state = s_up;
|
|
|
|
- ipcp_script(_PATH_IPUP, 0);
|
|
|
|
+ ipcp_script(path_ipup, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2009-05-21 10:49:21 +00:00
|
|
|
--- a/pppd/main.c
|
|
|
|
+++ b/pppd/main.c
|
2011-07-28 16:51:12 +00:00
|
|
|
@@ -316,6 +316,9 @@ main(argc, argv)
|
2009-05-20 22:36:38 +00:00
|
|
|
struct protent *protp;
|
|
|
|
char numbuf[16];
|
|
|
|
|
|
|
|
+ strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
|
|
|
|
+ strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
|
|
|
|
+
|
|
|
|
link_stats_valid = 0;
|
|
|
|
new_phase(PHASE_INITIALIZE);
|
|
|
|
|
2009-05-21 10:49:21 +00:00
|
|
|
--- a/pppd/options.c
|
|
|
|
+++ b/pppd/options.c
|
2014-06-15 20:55:17 +00:00
|
|
|
@@ -114,6 +114,8 @@ char linkname[MAXPATHLEN]; /* logical na
|
2009-05-20 22:36:38 +00:00
|
|
|
bool tune_kernel; /* may alter kernel settings */
|
|
|
|
int connect_delay = 1000; /* wait this many ms after connect script */
|
|
|
|
int req_unit = -1; /* requested interface unit */
|
|
|
|
+char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
|
|
|
|
+char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */
|
|
|
|
bool multilink = 0; /* Enable multilink operation */
|
|
|
|
char *bundle_name = NULL; /* bundle name for multilink */
|
|
|
|
bool dump_options; /* print out option values */
|
2014-06-15 20:55:17 +00:00
|
|
|
@@ -299,6 +301,13 @@ option_t general_options[] = {
|
|
|
|
"Unset user environment variable",
|
|
|
|
OPT_A2PRINTER | OPT_NOPRINT, (void *)user_unsetprint },
|
2009-05-20 22:36:38 +00:00
|
|
|
|
|
|
|
+ { "ip-up-script", o_string, path_ipup,
|
|
|
|
+ "Set pathname of ip-up script",
|
|
|
|
+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
|
|
|
|
+ { "ip-down-script", o_string, path_ipdown,
|
|
|
|
+ "Set pathname of ip-down script",
|
|
|
|
+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
|
|
|
|
+
|
|
|
|
#ifdef HAVE_MULTILINK
|
|
|
|
{ "multilink", o_bool, &multilink,
|
|
|
|
"Enable multilink operation", OPT_PRIO | 1 },
|
2009-05-21 10:49:21 +00:00
|
|
|
--- a/pppd/pppd.h
|
|
|
|
+++ b/pppd/pppd.h
|
2014-09-13 20:56:13 +00:00
|
|
|
@@ -318,6 +318,8 @@ extern bool tune_kernel; /* May alter ke
|
2009-05-20 22:36:38 +00:00
|
|
|
extern int connect_delay; /* Time to delay after connect script */
|
|
|
|
extern int max_data_rate; /* max bytes/sec through charshunt */
|
|
|
|
extern int req_unit; /* interface unit number to use */
|
|
|
|
+extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
|
|
|
|
+extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
|
|
|
|
extern bool multilink; /* enable multilink operation */
|
|
|
|
extern bool noendpoint; /* don't send or accept endpt. discrim. */
|
|
|
|
extern char *bundle_name; /* bundle name for multilink */
|