]> git.ozlabs.org Git - ppp.git/commitdiff
Add option to specify ip-up script
authorRussell Coker <russell@coker.com.au>
Wed, 30 Dec 2020 10:37:44 +0000 (11:37 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 30 Dec 2020 10:42:17 +0000 (11:42 +0100)
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=101587

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
pppd/ipcp.c
pppd/main.c
pppd/options.c
pppd/pppd.h

index 7357ac8ea546323f3ba178db99f0e77639beef3f..f8942a9645592ad7961b2555f8c8fd0393f23c1d 100644 (file)
@@ -1922,7 +1922,7 @@ ipcp_up(fsm *f)
      */
     if (ipcp_script_state == s_down && ipcp_script_pid == 0) {
        ipcp_script_state = s_up;
-       ipcp_script(_PATH_IPUP, 0);
+       ipcp_script(path_ipup, 0);
     }
 }
 
@@ -1971,7 +1971,7 @@ ipcp_down(fsm *f)
     /* Execute the ip-down script */
     if (ipcp_script_state == s_up && ipcp_script_pid == 0) {
        ipcp_script_state = s_down;
-       ipcp_script(_PATH_IPDOWN, 0);
+       ipcp_script(path_ipdown, 0);
     }
 }
 
@@ -2020,13 +2020,13 @@ ipcp_script_done(void *arg)
     case s_up:
        if (ipcp_fsm[0].state != OPENED) {
            ipcp_script_state = s_down;
-           ipcp_script(_PATH_IPDOWN, 0);
+           ipcp_script(path_ipdown, 0);
        }
        break;
     case s_down:
        if (ipcp_fsm[0].state == OPENED) {
            ipcp_script_state = s_up;
-           ipcp_script(_PATH_IPUP, 0);
+           ipcp_script(path_ipup, 0);
        }
        break;
     }
index 099c0505a4217ff942e75ffe3fb419996a0e7b57..2b5393624f7800e55d50beed334a85453422e312 100644 (file)
@@ -293,6 +293,9 @@ main(int argc, char *argv[])
     struct protent *protp;
     char numbuf[16];
 
+    strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
+    strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
+
     link_stats_valid = 0;
     new_phase(PHASE_INITIALIZE);
 
index c45f7cc552cbe1eba97b374b6fcd5e86259210dc..108e2b8c1197968f770bb3bb40bc560f9a53c19a 100644 (file)
@@ -115,6 +115,8 @@ char        linkname[MAXPATHLEN];   /* logical name for link */
 bool   tune_kernel;            /* may alter kernel settings */
 int    connect_delay = 1000;   /* wait this many ms after connect script */
 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   req_ifname[MAXIFNAMELEN];       /* requested interface name */
 bool   multilink = 0;          /* Enable multilink operation */
 char   *bundle_name = NULL;    /* bundle name for multilink */
@@ -315,6 +317,13 @@ option_t general_options[] = {
       "Metric to use for the default route (Linux only; -1 for default behavior)",
       OPT_PRIV|OPT_LLIMIT|OPT_INITONLY, NULL, 0, -1 },
 
+    { "ip-up-script", o_string, path_ipup,
+      "Set pathname of ip-up script",
+      OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
+    { "ip-down-script", o_string, path_ipdown,
+      "Set pathname of ip-down script",
+      OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
+
 #ifdef HAVE_MULTILINK
     { "multilink", o_bool, &multilink,
       "Enable multilink operation", OPT_PRIO | 1 },
index b5f3ad2a5d5f725943606b6b8ff47969ef15e0d5..32b914ef6c2a4b022726c3e52ab9bfb5cf94fa4a 100644 (file)
@@ -325,6 +325,8 @@ extern bool tune_kernel;    /* May alter kernel settings as necessary */
 extern int     connect_delay;  /* Time to delay after connect script */
 extern int     max_data_rate;  /* max bytes/sec through charshunt */
 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    req_ifname[MAXIFNAMELEN]; /* interface name to use */
 extern bool    multilink;      /* enable multilink operation */
 extern bool    noendpoint;     /* don't send or accept endpt. discrim. */