* $Id: pppd.h,v 1.96 2008/06/23 11:47:18 paulus Exp $
*/
-/*
- * TODO:
- */
+#ifndef PPP_PPPD_H
+#define PPP_PPPD_H
-#ifndef __PPPD_H__
-#define __PPPD_H__
+#include "pppdconf.h"
#include <stdio.h> /* for FILE */
#include <stdlib.h> /* for encrypt */
#include <unistd.h> /* for setkey */
-#include <limits.h> /* for NGROUPS_MAX */
-#include <sys/param.h> /* for MAXPATHLEN and BSD4_4, if defined */
+#include <stdarg.h>
+#include <stdint.h>
#include <sys/types.h> /* for u_int32_t, if defined */
-#include <sys/time.h> /* for struct timeval */
+#if defined(SOL2)
#include <net/ppp_defs.h>
-#include "patchlevel.h"
+#else
+#include <linux/ppp_defs.h>
+#endif
+
+#ifdef PPP_WITH_IPV6CP
+#if defined(SOL2)
+#include <netinet/in.h>
+
+typedef union {
+ uint8_t e8[8]; /* lower 64-bit IPv6 address */
+ uint32_t e32[2]; /* lower 64-bit IPv6 address */
+} eui64_t;
-#ifdef INET6
-#include "eui64.h"
+/*
+ * Declare the two below, since in.h only defines them when _KERNEL
+ * is declared - which shouldn't be true when dealing with user-land programs
+ */
+#define s6_addr8 _S6_un._S6_u8
+#define s6_addr32 _S6_un._S6_u32
+
+#else /* else if not defined(SOL2) */
+
+/*
+ * TODO:
+ *
+ * Maybe this should be done by processing struct in6_addr directly...
+ */
+typedef union
+{
+ u_int8_t e8[8];
+ u_int16_t e16[4];
+ u_int32_t e32[2];
+} eui64_t;
+
+#endif /* defined(SOL2) */
#endif
/*
#define MAXARGS 1 /* max # args to a command */
#define MAXNAMELEN 256 /* max length of hostname or name for auth */
#define MAXSECRETLEN 256 /* max length of password or secret */
-#define MAXIFNAMELEN 32 /* max length of interface name; or use IFNAMSIZ, can we
- always include net/if.h? */
/*
* If PPP_DRV_NAME is not defined, use the default "ppp" as the device name.
* pppd needs.
*/
struct pppd_stats {
- unsigned int bytes_in;
- unsigned int bytes_out;
+ uint64_t bytes_in;
+ uint64_t bytes_out;
unsigned int pkts_in;
unsigned int pkts_out;
};
extern int got_sigterm; /* SIGINT or SIGTERM was received */
extern int hungup; /* Physical layer has disconnected */
extern int ifunit; /* Interface unit number */
-extern char ifname[]; /* Interface name */
+extern char ifname[]; /* Interface name (IFNAMSIZ) */
extern char hostname[]; /* Our hostname */
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
extern int devfd; /* fd of underlying device */
extern int need_holdoff; /* Need holdoff period after link terminates */
extern char **script_env; /* Environment variables for scripts */
extern int detached; /* Have detached from controlling tty */
-extern GIDSET_TYPE groups[NGROUPS_MAX]; /* groups the user is in */
+extern GIDSET_TYPE groups[]; /* groups the user is in */
extern int ngroups; /* How many groups valid in groups */
extern struct pppd_stats link_stats; /* byte/packet counts etc. for link */
extern int link_stats_valid; /* set if link_stats is valid */
extern int do_callback; /* set if we want to do callback next */
extern int doing_callback; /* set if this is a callback */
extern int error_count; /* # of times error() has been called */
-extern char ppp_devnam[MAXPATHLEN];
+extern char ppp_devnam[]; /* name of PPP tty (maybe ttypx) */
extern char remote_number[MAXNAMELEN]; /* Remote telephone number, if avail. */
extern int ppp_session_number; /* Session number (eg PPPoE session) */
extern int fd_devnull; /* fd open to /dev/null */
extern int debug; /* Debug flag */
extern int kdebugflag; /* Tell kernel to print debug messages */
extern int default_device; /* Using /dev/tty or equivalent */
-extern char devnam[MAXPATHLEN]; /* Device name */
+extern char devnam[]; /* Device name */
extern int crtscts; /* Use hardware flow control */
extern int stop_bits; /* Number of serial port stop bits */
extern bool modem; /* Use modem control lines */
extern char *record_file; /* File to record chars sent/received */
extern bool sync_serial; /* Device is synchronous serial device */
extern int maxfail; /* Max # of unsuccessful connection attempts */
-extern char linkname[MAXPATHLEN]; /* logical name for link */
+extern char linkname[]; /* logical name for link */
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 req_ifname[MAXIFNAMELEN]; /* interface name to use */
+extern char path_ipup[]; /* pathname of ip-up script */
+extern char path_ipdown[]; /* pathname of ip-down script */
+extern char req_ifname[]; /* interface name to use (IFNAMSIZ) */
extern bool multilink; /* enable multilink operation */
extern bool noendpoint; /* don't send or accept endpt. discrim. */
extern char *bundle_name; /* bundle name for multilink */
extern bool dump_options; /* print out option values */
+extern bool show_options; /* show all option names and descriptions */
extern bool dryrun; /* check everything, print options, exit */
extern int child_wait; /* # seconds to wait for children at end */
-#ifdef USE_EAPTLS
-extern char *crl_dir;
-extern char *crl_file;
+#ifdef PPP_WITH_IPV6CP
+extern char path_ipv6up[]; /* pathname of ipv6-up script */
+extern char path_ipv6down[]; /* pathname of ipv6-down script */
+#endif
+
+#if defined(PPP_WITH_EAPTLS) || defined(PPP_WITH_PEAP)
+#define TLS_VERIFY_NONE "none"
+#define TLS_VERIFY_NAME "name"
+#define TLS_VERIFY_SUBJECT "subject"
+#define TLS_VERIFY_SUFFIX "suffix"
+
+extern char *crl_dir;
+extern char *crl_file;
+extern char *ca_path;
+extern char *cacert_file;
+
extern char *max_tls_version;
-#endif /* USE_EAPTLS */
+extern bool tls_verify_key_usage;
+extern char *tls_verify_method;
+#endif /* PPP_WITH_EAPTLS || PPP_WITH_PEAP */
+
+#ifdef PPP_WITH_EAPTLS
+extern char *pkcs12_file;
+#endif /* PPP_WITH_EAPTLS */
-#ifdef MAXOCTETS
extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */
extern int maxoctets_dir; /* Direction :
0 - in+out (default)
- 1 - in
+ 1 - in
2 - out
3 - max(in,out) */
extern int maxoctets_timeout; /* Timeout for check of octets limit */
#define PPP_OCTETS_DIRECTION_OUT 2
#define PPP_OCTETS_DIRECTION_MAXOVERAL 3
/* same as previos, but little different on RADIUS side */
-#define PPP_OCTETS_DIRECTION_MAXSESSION 4
-#endif
+#define PPP_OCTETS_DIRECTION_MAXSESSION 4
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
extern struct bpf_program pass_filter; /* Filter for pkts to pass */
extern struct bpf_program active_filter; /* Filter for link-active pkts */
#endif
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
extern bool ms_lanman; /* Use LanMan password instead of NT */
/* Has meaning only with MS-CHAP challenges */
#endif
int loop_frame(unsigned char *, int); /* should we bring link up? */
/* Procedures exported from multilink.c */
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
void mp_check_options(void); /* Check multilink-related options */
int mp_join_bundle(void); /* join our link to an appropriate bundle */
void mp_exit_bundle(void); /* have disconnected our link from bundle */
/* Configure IPv4 addresses for i/f */
int cifaddr(int, u_int32_t, u_int32_t);
/* Reset i/f IP addresses */
-#ifdef INET6
-int ether_to_eui64(eui64_t *p_eui64); /* convert eth0 hw address to EUI64 */
+#ifdef PPP_WITH_IPV6CP
int sif6up(int); /* Configure i/f up for IPv6 */
int sif6down(int); /* Configure i/f down for IPv6 */
int sif6addr(int, eui64_t, eui64_t);
int cif6addr(int, eui64_t, eui64_t);
/* Remove an IPv6 address from i/f */
#endif
-int sifdefaultroute(int, u_int32_t, u_int32_t);
+int sifdefaultroute(int, u_int32_t, u_int32_t, bool replace_default_rt);
/* Create default route through i/f */
int cifdefaultroute(int, u_int32_t, u_int32_t);
/* Delete default route through i/f */
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
int sif6defaultroute(int, eui64_t, eui64_t);
/* Create default IPv6 route through i/f */
int cif6defaultroute(int, eui64_t, eui64_t);
/* Write entry to wtmp file */
int get_host_seed(void); /* Get host-dependent random number seed */
int have_route_to(u_int32_t); /* Check if route to addr exists */
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
int set_filters(struct bpf_program *pass, struct bpf_program *active);
/* Set filter programs in kernel */
#endif
-#ifdef IPX_CHANGE
-int sipxfaddr(int, unsigned long, unsigned char *);
-int cipxfaddr(int);
-#endif
int get_if_hwaddr(u_char *addr, char *name);
-char *get_first_ethernet(void);
+int get_first_ether_hwaddr(u_char *addr);
int get_time(struct timeval *);
/* Get current time, monotonic if possible. */
/* override value if permitted by priority */
void print_options(printer_func, void *);
/* print out values of all options */
-
+void showopts(void);
+ /* show all option names and description */
int parse_dotted_ip(char *, u_int32_t *);
/*
extern int (*chap_passwd_hook)(char *user, char *passwd);
extern void (*multilink_join_hook)(void);
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
extern int (*eaptls_passwd_hook)(char *user, char *passwd);
#endif
#define EXIT_LOOPBACK 17
#define EXIT_INIT_FAILED 18
#define EXIT_AUTH_TOPEER_FAILED 19
-#ifdef MAXOCTETS
#define EXIT_TRAFFIC_LIMIT 20
-#endif
#define EXIT_CNID_AUTH_FAILED 21
/*
#define CHAPDEBUG(x)
#endif
-#ifdef DEBUGIPXCP
-#define IPXCPDEBUG(x) if (debug) dbglog x
-#else
-#define IPXCPDEBUG(x)
-#endif
-
#ifndef SIGTYPE
#if defined(sun) || defined(SYSV) || defined(POSIX_SOURCE)
#define SIGTYPE void
#define offsetof(type, member) ((size_t) &((type *)0)->member)
#endif
-#endif /* __PPP_H__ */
+#endif /* PPP_PPPD_H */