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