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 <jo@mein.io>
15 @@ -1957,7 +1957,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 @@ -2007,7 +2007,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 @@ -2061,13 +2061,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 @@ -306,6 +306,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 @@ -117,6 +117,8 @@ bool tune_kernel; /* may alter kernel s
64 int connect_delay = 1000; /* wait this many ms after connect script */
65 int req_unit = -1; /* requested interface unit */
66 char req_ifname[MAXIFNAMELEN]; /* requested interface name */
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 @@ -316,6 +318,13 @@ option_t general_options[] = {
73 "Metric to use for the default route (Linux only; -1 for default behavior)",
74 OPT_PRIV|OPT_LLIMIT|OPT_INITONLY, NULL, 0, -1 },
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 @@ -335,6 +335,8 @@ extern int connect_delay; /* Time to del
89 extern int max_data_rate; /* max bytes/sec through charshunt */
90 extern int req_unit; /* interface unit number to use */
91 extern char req_ifname[MAXIFNAMELEN]; /* interface name 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 */