]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/main.c
Update README to fix an error
[ppp.git] / pppd / main.c
index 9fbcfb66275f4058331934fa8995e1819732b6f8..7f73e0dac1e47b958db600384d4ad7a9984567a7 100644 (file)
@@ -55,7 +55,7 @@
  * 3. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
  *    "This product includes software developed by Paul Mackerras
  * 3. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
  *    "This product includes software developed by Paul Mackerras
- *     <paulus@samba.org>".
+ *     <paulus@ozlabs.org>".
  *
  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  *
  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -363,10 +363,16 @@ main(int argc, char *argv[])
     struct protent *protp;
     char numbuf[16];
 
     struct protent *protp;
     char numbuf[16];
 
-    PPP_crypto_init();
+    strlcpy(path_upapfile, PPP_PATH_UPAPFILE, MAXPATHLEN);
+    strlcpy(path_chapfile, PPP_PATH_CHAPFILE, MAXPATHLEN);
+
+    strlcpy(path_net_init, PPP_PATH_NET_INIT, MAXPATHLEN);
+    strlcpy(path_net_preup, PPP_PATH_NET_PREUP, MAXPATHLEN);
+    strlcpy(path_net_down, PPP_PATH_NET_DOWN, MAXPATHLEN);
 
     strlcpy(path_ipup, PPP_PATH_IPUP, MAXPATHLEN);
     strlcpy(path_ipdown, PPP_PATH_IPDOWN, MAXPATHLEN);
 
     strlcpy(path_ipup, PPP_PATH_IPUP, MAXPATHLEN);
     strlcpy(path_ipdown, PPP_PATH_IPDOWN, MAXPATHLEN);
+    strlcpy(path_ippreup, PPP_PATH_IPPREUP, MAXPATHLEN);
 
 #ifdef PPP_WITH_IPV6CP
     strlcpy(path_ipv6up, PPP_PATH_IPV6UP, MAXPATHLEN);
 
 #ifdef PPP_WITH_IPV6CP
     strlcpy(path_ipv6up, PPP_PATH_IPV6UP, MAXPATHLEN);
@@ -381,6 +387,11 @@ main(int argc, char *argv[])
     /* Initialize syslog facilities */
     reopen_log();
 
     /* Initialize syslog facilities */
     reopen_log();
 
+    /* Initialize crypto libraries */
+    if (!PPP_crypto_init()) {
+        exit(1);
+    }
+
     if (gethostname(hostname, sizeof(hostname)) < 0 ) {
        ppp_option_error("Couldn't get hostname: %m");
        exit(1);
     if (gethostname(hostname, sizeof(hostname)) < 0 ) {
        ppp_option_error("Couldn't get hostname: %m");
        exit(1);
@@ -841,7 +852,7 @@ set_ifunit(int iskey)
        create_pidfile(getpid());       /* write pid to file */
        create_linkpidfile(getpid());
     }
        create_pidfile(getpid());       /* write pid to file */
        create_linkpidfile(getpid());
     }
-    run_net_script(PPP_PATH_NET_INIT, 1);
+    run_net_script(path_net_init, 1);
 }
 
 /*
 }
 
 /*
@@ -1249,7 +1260,7 @@ new_phase(ppp_phase_t p)
        if (phase <= PHASE_NETWORK) {
            char iftmpname[IFNAMSIZ];
            int ifindex = if_nametoindex(ifname);
        if (phase <= PHASE_NETWORK) {
            char iftmpname[IFNAMSIZ];
            int ifindex = if_nametoindex(ifname);
-           run_net_script(PPP_PATH_NET_PREUP, 1);
+           run_net_script(path_net_preup, 1);
            if (if_indextoname(ifindex, iftmpname) && strcmp(iftmpname, ifname)) {
                info("Detected interface name change from %s to %s.", ifname, iftmpname);
                strcpy(ifname, iftmpname);
            if (if_indextoname(ifindex, iftmpname) && strcmp(iftmpname, ifname)) {
                info("Detected interface name change from %s to %s.", ifname, iftmpname);
                strcpy(ifname, iftmpname);
@@ -1257,7 +1268,7 @@ new_phase(ppp_phase_t p)
        }
        break;
     case PHASE_DISCONNECT:
        }
        break;
     case PHASE_DISCONNECT:
-       run_net_script(PPP_PATH_NET_DOWN, 0);
+       run_net_script(path_net_down, 0);
        break;
     }
 
        break;
     }
 
@@ -1331,9 +1342,9 @@ print_link_stats(void)
 void
 reset_link_stats(int u)
 {
 void
 reset_link_stats(int u)
 {
-    if (!get_ppp_stats(u, &old_link_stats))
-       return;
+    get_ppp_stats(u, &old_link_stats);
     ppp_get_time(&start_time);
     ppp_get_time(&start_time);
+    link_stats_print = 1;
 }
 
 /*
 }
 
 /*
@@ -2150,7 +2161,7 @@ notify(struct notifier *notif, int val)
  * novm - log an error message saying we ran out of memory, and die.
  */
 void
  * novm - log an error message saying we ran out of memory, and die.
  */
 void
-novm(char *msg)
+novm(const char *msg)
 {
     fatal("Virtual memory exhausted allocating %s\n", msg);
 }
 {
     fatal("Virtual memory exhausted allocating %s\n", msg);
 }