1 pppd: Allow specifying ip-up and ip-down scripts
3 This patch implements the "ip-up-script" and "ip-down-script" options which
4 allow to specify the path of the ip-up and ip-down scripts to call.
6 These options default to _PATH_IPUP and _PATH_IPDOWN to retain the
9 The patch originated from the Debian project.
11 Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
15 @@ -1958,7 +1958,7 @@ ipcp_up(f)
17 if (ipcp_script_state == s_down && ipcp_script_pid == 0) {
18 ipcp_script_state = s_up;
19 - ipcp_script(_PATH_IPUP, 0);
20 + ipcp_script(path_ipup, 0);
24 @@ -2008,7 +2008,7 @@ ipcp_down(f)
25 /* Execute the ip-down script */
26 if (ipcp_script_state == s_up && ipcp_script_pid == 0) {
27 ipcp_script_state = s_down;
28 - ipcp_script(_PATH_IPDOWN, 0);
29 + ipcp_script(path_ipdown, 0);
33 @@ -2062,13 +2062,13 @@ ipcp_script_done(arg)
35 if (ipcp_fsm[0].state != OPENED) {
36 ipcp_script_state = s_down;
37 - ipcp_script(_PATH_IPDOWN, 0);
38 + ipcp_script(path_ipdown, 0);
42 if (ipcp_fsm[0].state == OPENED) {
43 ipcp_script_state = s_up;
44 - ipcp_script(_PATH_IPUP, 0);
45 + ipcp_script(path_ipup, 0);
51 @@ -316,6 +316,9 @@ main(argc, argv)
52 struct protent *protp;
55 + strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
56 + strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
59 new_phase(PHASE_INITIALIZE);
63 @@ -114,6 +114,8 @@ char linkname[MAXPATHLEN]; /* logical na
64 bool tune_kernel; /* may alter kernel settings */
65 int connect_delay = 1000; /* wait this many ms after connect script */
66 int req_unit = -1; /* requested interface unit */
67 +char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
68 +char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */
69 bool multilink = 0; /* Enable multilink operation */
70 char *bundle_name = NULL; /* bundle name for multilink */
71 bool dump_options; /* print out option values */
72 @@ -299,6 +301,13 @@ option_t general_options[] = {
73 "Unset user environment variable",
74 OPT_A2PRINTER | OPT_NOPRINT, (void *)user_unsetprint },
76 + { "ip-up-script", o_string, path_ipup,
77 + "Set pathname of ip-up script",
78 + OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
79 + { "ip-down-script", o_string, path_ipdown,
80 + "Set pathname of ip-down script",
81 + OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
84 { "multilink", o_bool, &multilink,
85 "Enable multilink operation", OPT_PRIO | 1 },
88 @@ -318,6 +318,8 @@ extern bool tune_kernel; /* May alter ke
89 extern int connect_delay; /* Time to delay after connect script */
90 extern int max_data_rate; /* max bytes/sec through charshunt */
91 extern int req_unit; /* interface unit number to use */
92 +extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
93 +extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
94 extern bool multilink; /* enable multilink operation */
95 extern bool noendpoint; /* don't send or accept endpt. discrim. */
96 extern char *bundle_name; /* bundle name for multilink */