78cd384 Update README and patchlevel.h for 2.4.8 release 5d03403 pppd: Avoid use of strnlen (and strlen) in vslprintf a1e950a pppd: Fix IPv6 default route code for Solaris ca5e61b plugins/rp-pppoe: Make tag parsing loop condition more accurate c10c3c7 pppd: Make sure word read from options file is null-terminated b311e98 pppd: Limit memory accessed by string formats with max length specified 3ea9de9 pppd: Eliminate some more compiler warnings 57edb1a pppd: Include time.h header before using time_t 09f695f pppd: Don't free static string 03104ba pppd.h: Add missing headers 388597e pppd: Add defaultroute6 and related options 66ce4ba pppd: Avoid declarations within statements in main.c 5637180 pppd: Fix `ifname` option in case of multilink (#105) d00f8a0 pppd: Fix variable reference syntax in Makefile.linux b6b4d28 pppd: Check tdb pointer before closing Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
96 lines
3.2 KiB
Diff
96 lines
3.2 KiB
Diff
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.
|
|
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
--- a/pppd/ipcp.c
|
|
+++ b/pppd/ipcp.c
|
|
@@ -1957,7 +1957,7 @@ ipcp_up(f)
|
|
*/
|
|
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);
|
|
}
|
|
}
|
|
|
|
@@ -2007,7 +2007,7 @@ ipcp_down(f)
|
|
/* 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);
|
|
}
|
|
}
|
|
|
|
@@ -2061,13 +2061,13 @@ ipcp_script_done(arg)
|
|
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;
|
|
}
|
|
--- a/pppd/main.c
|
|
+++ b/pppd/main.c
|
|
@@ -306,6 +306,9 @@ main(argc, argv)
|
|
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);
|
|
|
|
--- a/pppd/options.c
|
|
+++ b/pppd/options.c
|
|
@@ -117,6 +117,8 @@ bool tune_kernel; /* may alter kernel s
|
|
int connect_delay = 1000; /* wait this many ms after connect script */
|
|
int req_unit = -1; /* requested interface unit */
|
|
char req_ifname[MAXIFNAMELEN]; /* requested interface name */
|
|
+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 */
|
|
@@ -316,6 +318,13 @@ option_t general_options[] = {
|
|
"Metric to use for the default route (Linux only; -1 for default behavior)",
|
|
OPT_PRIV|OPT_LLIMIT|OPT_INITONLY, NULL, 0, -1 },
|
|
|
|
+ { "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 },
|
|
--- a/pppd/pppd.h
|
|
+++ b/pppd/pppd.h
|
|
@@ -334,6 +334,8 @@ extern int connect_delay; /* Time to del
|
|
extern int max_data_rate; /* max bytes/sec through charshunt */
|
|
extern int req_unit; /* interface unit number to use */
|
|
extern char req_ifname[MAXIFNAMELEN]; /* interface name 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 */
|