1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- pppd: Allow specifying ipv6-up and ipv6-down scripts
- This patch implements the "ipv6-up-script" and "ipv6-down-script" options
- which allow to specify the path of the ipv6-up and ipv6-down scripts to call.
- These options default to _PATH_IPV6UP and _PATH_IPV6DOWN to retain the
- existing behaviour.
- The patch originated from the Debian project.
- Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
- --- a/pppd/main.c
- +++ b/pppd/main.c
- @@ -318,6 +318,8 @@ main(argc, argv)
-
- strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
- strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
- + strlcpy(path_ipv6up, _PATH_IPV6UP, sizeof(path_ipv6up));
- + strlcpy(path_ipv6down, _PATH_IPV6DOWN, sizeof(path_ipv6down));
-
- link_stats_valid = 0;
- new_phase(PHASE_INITIALIZE);
- --- a/pppd/options.c
- +++ b/pppd/options.c
- @@ -116,6 +116,8 @@ int connect_delay = 1000; /* wait this m
- 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 */
- +char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */
- +char path_ipv6down[MAXPATHLEN];/* pathname of ipv6-down script */
- bool multilink = 0; /* Enable multilink operation */
- char *bundle_name = NULL; /* bundle name for multilink */
- bool dump_options; /* print out option values */
- @@ -308,6 +310,13 @@ option_t general_options[] = {
- "Set pathname of ip-down script",
- OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
-
- + { "ipv6-up-script", o_string, path_ipv6up,
- + "Set pathname of ipv6-up script",
- + OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
- + { "ipv6-down-script", o_string, path_ipv6down,
- + "Set pathname of ipv6-down script",
- + OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
- +
- #ifdef HAVE_MULTILINK
- { "multilink", o_bool, &multilink,
- "Enable multilink operation", OPT_PRIO | 1 },
- --- a/pppd/ipv6cp.c
- +++ b/pppd/ipv6cp.c
- @@ -1269,7 +1269,7 @@ ipv6cp_up(f)
- */
- if (ipv6cp_script_state == s_down && ipv6cp_script_pid == 0) {
- ipv6cp_script_state = s_up;
- - ipv6cp_script(_PATH_IPV6UP);
- + ipv6cp_script(path_ipv6up);
- }
- }
-
- @@ -1321,7 +1321,7 @@ ipv6cp_down(f)
- /* Execute the ipv6-down script */
- if (ipv6cp_script_state == s_up && ipv6cp_script_pid == 0) {
- ipv6cp_script_state = s_down;
- - ipv6cp_script(_PATH_IPV6DOWN);
- + ipv6cp_script(path_ipv6down);
- }
- }
-
- @@ -1364,13 +1364,13 @@ ipv6cp_script_done(arg)
- case s_up:
- if (ipv6cp_fsm[0].state != OPENED) {
- ipv6cp_script_state = s_down;
- - ipv6cp_script(_PATH_IPV6DOWN);
- + ipv6cp_script(path_ipv6down);
- }
- break;
- case s_down:
- if (ipv6cp_fsm[0].state == OPENED) {
- ipv6cp_script_state = s_up;
- - ipv6cp_script(_PATH_IPV6UP);
- + ipv6cp_script(path_ipv6up);
- }
- break;
- }
- --- a/pppd/pppd.h
- +++ b/pppd/pppd.h
- @@ -320,6 +320,8 @@ extern int max_data_rate; /* max bytes/s
- 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 char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */
- +extern char path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-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 */
|