1
0

120-debian_ipv6_updown_option.patch 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. pppd: Allow specifying ipv6-up and ipv6-down scripts
  2. This patch implements the "ipv6-up-script" and "ipv6-down-script" options
  3. which allow to specify the path of the ipv6-up and ipv6-down scripts to call.
  4. These options default to _PATH_IPV6UP and _PATH_IPV6DOWN to retain the
  5. existing behaviour.
  6. The patch originated from the Debian project.
  7. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  8. --- a/pppd/main.c
  9. +++ b/pppd/main.c
  10. @@ -318,6 +318,8 @@ main(argc, argv)
  11. strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
  12. strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
  13. + strlcpy(path_ipv6up, _PATH_IPV6UP, sizeof(path_ipv6up));
  14. + strlcpy(path_ipv6down, _PATH_IPV6DOWN, sizeof(path_ipv6down));
  15. link_stats_valid = 0;
  16. new_phase(PHASE_INITIALIZE);
  17. --- a/pppd/options.c
  18. +++ b/pppd/options.c
  19. @@ -116,6 +116,8 @@ int connect_delay = 1000; /* wait this m
  20. int req_unit = -1; /* requested interface unit */
  21. char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
  22. char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */
  23. +char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */
  24. +char path_ipv6down[MAXPATHLEN];/* pathname of ipv6-down script */
  25. bool multilink = 0; /* Enable multilink operation */
  26. char *bundle_name = NULL; /* bundle name for multilink */
  27. bool dump_options; /* print out option values */
  28. @@ -308,6 +310,13 @@ option_t general_options[] = {
  29. "Set pathname of ip-down script",
  30. OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
  31. + { "ipv6-up-script", o_string, path_ipv6up,
  32. + "Set pathname of ipv6-up script",
  33. + OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
  34. + { "ipv6-down-script", o_string, path_ipv6down,
  35. + "Set pathname of ipv6-down script",
  36. + OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
  37. +
  38. #ifdef HAVE_MULTILINK
  39. { "multilink", o_bool, &multilink,
  40. "Enable multilink operation", OPT_PRIO | 1 },
  41. --- a/pppd/ipv6cp.c
  42. +++ b/pppd/ipv6cp.c
  43. @@ -1269,7 +1269,7 @@ ipv6cp_up(f)
  44. */
  45. if (ipv6cp_script_state == s_down && ipv6cp_script_pid == 0) {
  46. ipv6cp_script_state = s_up;
  47. - ipv6cp_script(_PATH_IPV6UP);
  48. + ipv6cp_script(path_ipv6up);
  49. }
  50. }
  51. @@ -1321,7 +1321,7 @@ ipv6cp_down(f)
  52. /* Execute the ipv6-down script */
  53. if (ipv6cp_script_state == s_up && ipv6cp_script_pid == 0) {
  54. ipv6cp_script_state = s_down;
  55. - ipv6cp_script(_PATH_IPV6DOWN);
  56. + ipv6cp_script(path_ipv6down);
  57. }
  58. }
  59. @@ -1364,13 +1364,13 @@ ipv6cp_script_done(arg)
  60. case s_up:
  61. if (ipv6cp_fsm[0].state != OPENED) {
  62. ipv6cp_script_state = s_down;
  63. - ipv6cp_script(_PATH_IPV6DOWN);
  64. + ipv6cp_script(path_ipv6down);
  65. }
  66. break;
  67. case s_down:
  68. if (ipv6cp_fsm[0].state == OPENED) {
  69. ipv6cp_script_state = s_up;
  70. - ipv6cp_script(_PATH_IPV6UP);
  71. + ipv6cp_script(path_ipv6up);
  72. }
  73. break;
  74. }
  75. --- a/pppd/pppd.h
  76. +++ b/pppd/pppd.h
  77. @@ -320,6 +320,8 @@ extern int max_data_rate; /* max bytes/s
  78. extern int req_unit; /* interface unit number to use */
  79. extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
  80. extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
  81. +extern char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */
  82. +extern char path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-down script */
  83. extern bool multilink; /* enable multilink operation */
  84. extern bool noendpoint; /* don't send or accept endpt. discrim. */
  85. extern char *bundle_name; /* bundle name for multilink */