Home | History | Annotate | Line # | Download | only in pppd
      1 /*	$NetBSD: pathnames.h,v 1.6 2025/01/08 19:59:39 christos Exp $	*/
      2 
      3 /*
      4  * pathnames.h - define default paths for pppd
      5  *
      6  * Copyright (c) 1999-2024 Paul Mackerras. All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  *
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  *
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in
     17  *    the documentation and/or other materials provided with the
     18  *    distribution.
     19  *
     20  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
     21  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     22  * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
     23  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     24  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
     25  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
     26  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     27  */
     28 
     29 /*
     30  * Paths are controlled by configure. Typically, one would pass the following options
     31  * to configure:
     32  *    ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
     33  *
     34  * Note that if the prefix variable do control all the other directory variables, e.g
     35  * sysconfdir is ${prefix}/etc. Setting prefix to /usr, you'll have to override
     36  * sysconfdir with /etc to avoid installing config files into /usr/etc.
     37  *
     38  * In addition, there are three explicit variables that has overrides via configure:
     39  * - PPPD_RUNTIME_DIR, set by --with-runtime-dir=<dir>
     40  * - PPPD_LOGFILE_DIR, set by --with-logfile-dir=<dir>
     41  * - PPPD_PLUGIN_DIR, set by --with-plugin-dir=<dir>
     42  */
     43 #ifndef PPP_PATHNAMES_H
     44 #define PPP_PATHNAMES_H
     45 
     46 #include "pppdconf.h"
     47 
     48 #ifdef HAVE_PATHS_H
     49 #include <paths.h>
     50 #endif /* HAVE_PATHS_H */
     51 
     52 #ifndef _PATH_DEVNULL
     53 #define _PATH_DEVNULL           "/dev/null"
     54 #endif
     55 
     56 #define PPP_DEVNULL             _PATH_DEVNULL
     57 
     58 /*
     59  * PPPD_RUNTIME_DIR is set by passing --with-runtime-dir=<path> via configure
     60  *    the default value set by configure when option is absent is ${localstatedir}/run/pppd
     61  */
     62 #ifdef PPPD_RUNTIME_DIR
     63 #define PPP_PATH_VARRUN         PPPD_RUNTIME_DIR
     64 #else
     65 #define PPP_PATH_VARRUN         _PATH_VARRUN
     66 #endif
     67 
     68 /*
     69  * PPPD_LOGFILE_DIR is set by passing --with-logfile-dir=<path> via configure
     70  *    the default value set by configure when option is absent is ${localstatedir}/log/ppp
     71  */
     72 #ifdef PPPD_LOGFILE_DIR
     73 #define PPP_PATH_VARLOG         PPPD_LOGFILE_DIR
     74 #else
     75 #define PPP_PATH_VARLOG         _PATH_VARRUN "/log/ppp"
     76 #endif
     77 
     78 /*
     79  * PPPD_PLUGIN_DIR is set by passing --with-plugin-dir=<path> via configure
     80  *    the default value set by configure when option is absent is ${libdir}/pppd/${version}
     81  */
     82 #ifdef PPPD_PLUGIN_DIR
     83 #define PPP_PATH_PLUGIN         PPPD_PLUGIN_DIR
     84 #endif /* PPPD_PLUGIN_DIR */
     85 
     86 #define PPP_PATH_CONFDIR        SYSCONFDIR "/ppp"
     87 
     88 #define PPP_PATH_UPAPFILE       PPP_PATH_CONFDIR "/pap-secrets"
     89 #define PPP_PATH_CHAPFILE       PPP_PATH_CONFDIR "/chap-secrets"
     90 #define PPP_PATH_SRPFILE        PPP_PATH_CONFDIR "/srp-secrets"
     91 
     92 #ifdef PPP_WITH_EAPTLS
     93 #define PPP_PATH_EAPTLSCLIFILE  PPP_PATH_CONFDIR "/eaptls-client"
     94 #define PPP_PATH_EAPTLSSERVFILE PPP_PATH_CONFDIR "/eaptls-server"
     95 #define PPP_PATH_OPENSSLCONFFILE PPP_PATH_CONFDIR "/openssl.cnf"
     96 #endif /* PPP_WITH_EAPTLS */
     97 
     98 #define PPP_PATH_SYSOPTIONS     PPP_PATH_CONFDIR "/options"
     99 #define PPP_PATH_IPUP           PPP_PATH_CONFDIR "/ip-up"
    100 #define PPP_PATH_IPDOWN         PPP_PATH_CONFDIR "/ip-down"
    101 #define PPP_PATH_IPPREUP        PPP_PATH_CONFDIR "/ip-pre-up"
    102 #define PPP_PATH_AUTHUP         PPP_PATH_CONFDIR "/auth-up"
    103 #define PPP_PATH_AUTHDOWN       PPP_PATH_CONFDIR "/auth-down"
    104 #define PPP_PATH_TTYOPT         PPP_PATH_CONFDIR "/options."
    105 #define PPP_PATH_PEERFILES      PPP_PATH_CONFDIR "/peers/"
    106 #define PPP_PATH_RESOLV         PPP_PATH_CONFDIR "/resolv.conf"
    107 
    108 #define PPP_PATH_NET_INIT	PPP_PATH_CONFDIR "/net-init"
    109 #define PPP_PATH_NET_PREUP	PPP_PATH_CONFDIR "/net-pre-up"
    110 #define PPP_PATH_NET_DOWN	PPP_PATH_CONFDIR "/net-down"
    111 
    112 #define PPP_PATH_CONNERRS       PPP_PATH_VARLOG  "/connect-errors"
    113 
    114 #define PPP_PATH_USEROPT        ".ppprc"
    115 #define PPP_PATH_PSEUDONYM	    ".ppp_pseudonym"
    116 
    117 #ifdef PPP_WITH_IPV6CP
    118 #define PPP_PATH_IPV6UP         PPP_PATH_CONFDIR "/ipv6-up"
    119 #define PPP_PATH_IPV6DOWN       PPP_PATH_CONFDIR "/ipv6-down"
    120 #endif
    121 
    122 #define PPP_PATH_PPPDB          PPP_PATH_VARRUN  "/pppd2.tdb"
    123 
    124 #ifdef __linux__
    125 #define PPP_PATH_LOCKDIR        "/var/lock"
    126 #else
    127 #ifdef SVR4
    128 #define PPP_PATH_LOCKDIR        "/var/spool/locks"
    129 #else
    130 #define PPP_PATH_LOCKDIR        "/var/spool/lock"
    131 #endif
    132 #endif
    133 
    134 #endif /* PPP_PATHNAMES_H */
    135