/pppd/config.h
/pppd/config.h.in
/pppd/pppdconf.h
+/pppd/plugins/pppoe/config.h
+/pppd/plugins/pppoe/stamp-h3
# https://www.gnu.org/software/libtool/
/libtool
SUBDIRS = chat contrib pppd pppstats pppdump
-if WITH_PLUGINS
+if PPP_WITH_PLUGINS
SUBDIRS += pppd/plugins
endif
AC_LANG(C)
AC_CONFIG_SRCDIR([pppd/main.c])
-AC_CONFIG_HEADERS([pppd/config.h pppd/pppdconf.h])
+AC_CONFIG_HEADERS([pppd/config.h pppd/pppdconf.h pppd/plugins/pppoe/config.h])
# Checks for programs.
AC_PROG_CC
;;
esac
-AM_CONDITIONAL([LINUX], [test "${build_linux}" = "yes" ])
-AM_CONDITIONAL([SUNOS], [test "${build_sunos}" = "yes" ])
+AM_CONDITIONAL([LINUX], [test "x${build_linux}" = "xyes" ])
+AM_CONDITIONAL([SUNOS], [test "x${build_sunos}" = "xyes" ])
AM_COND_IF([SUNOS],
CFLAGS="$CFLAGS -DSOL2 -DSRV4")
# If libc doesn't provide logwtmp, check if libutil provides logwtmp(), and if so link to it.
AS_IF([test "x${ac_cv_func_logwtmp}" != "xyes"], [
AC_CHECK_LIB([util], [logwtmp], [
- AC_DEFINE(HAVE_LOGWTMP, 1, ["System provides the logwtmp() function"])
+ AC_DEFINE(HAVE_LOGWTMP, 1, [System provides the logwtmp() function])
AC_SUBST([UTIL_LIBS], ["-lutil"])
])
])
AM_CONDITIONAL(WITH_SYSTEMD, test "x${enable_systemd}" = "xyes")
AM_COND_IF([WITH_SYSTEMD],
AC_DEFINE([SYSTEMD], 1, [Enable support for systemd notifications]))
+AS_IF([test "x${enable_systemd}" = "xyes"], [
+ PKG_CHECK_MODULES([systemd], [systemd])])
#
# Enable Callback Protocol Support, disabled by default
AC_ARG_ENABLE([cbcp],
AS_HELP_STRING([--enable-cbcp], [Enable Callback Protocol]))
-AM_CONDITIONAL(WITH_CBCP, test "x${enable_cbcp}" = "xyes")
-AM_COND_IF([WITH_CBCP],
- AC_DEFINE([CBCP_SUPPORT], 1, [Have Callback Protocol support]))
-
-#
-# Disable support for limiting session duration by maximum octets
-AC_ARG_ENABLE([maxoctets],
- AS_HELP_STRING([--disable-maxoctets], [Disable support for limiting session by maximum octets]))
-AS_IF([test "x$enable_maxoctets" != "xno"],
- AC_DEFINE([MAXOCTETS], 1, ["Limit sessions by maximum number of octets"]))
+AM_CONDITIONAL(PPP_WITH_CBCP, test "x${enable_cbcp}" = "xyes")
+AM_COND_IF([PPP_WITH_CBCP],
+ AC_DEFINE([PPP_WITH_CBCP], 1, [Have Callback Protocol support]))
#
# Disable Microsoft extensions will remove CHAP and MPPE support
AC_ARG_ENABLE([microsoft-extensions],
AS_HELP_STRING([--disable-microsoft-extensions], [Disable Microsoft CHAP / MPPE extensions]))
-AM_CONDITIONAL(WITH_CHAPMS, test "x${enable_microsoft_extensions}" != "xno")
-AM_COND_IF([WITH_CHAPMS],
- AC_DEFINE([CHAPMS], 1, ["Have Microsoft CHAP support"]))
+AM_CONDITIONAL(PPP_WITH_CHAPMS, test "x${enable_microsoft_extensions}" != "xno")
+AM_COND_IF([PPP_WITH_CHAPMS],
+ AC_DEFINE([PPP_WITH_CHAPMS], 1, [Have Microsoft CHAP support]))
-AM_CONDITIONAL(WITH_MPPE, test "x${enable_microsoft_extensions}" != "xno")
-AM_COND_IF([WITH_MPPE],
- AC_DEFINE([MPPE], 1, ["Have Microsoft MPPE support"]))
+AM_CONDITIONAL(PPP_WITH_MPPE, test "x${enable_microsoft_extensions}" != "xno")
+AM_COND_IF([PPP_WITH_MPPE],
+ AC_DEFINE([PPP_WITH_MPPE], 1, [Have Microsoft MPPE support]))
#
# Enable Microsoft LAN Manager support, depends on Microsoft Extensions
AC_ARG_ENABLE([mslanman],
AS_HELP_STRING([--enable-mslanman], [Enable Microsoft LAN Manager support]))
AS_IF([test "x${enable_mslanman}" = "xyes" && test "x${enable_microsoft_extensions}" != "xno"],
- AC_DEFINE([MSLANMAN], 1, ["Have Microsoft LAN Manager support"]))
+ AC_DEFINE([PPP_WITH_MSLANMAN], 1, [Have Microsoft LAN Manager support]))
#
# Disable IPv6 support
-AC_ARG_ENABLE([ipv6-support],
- AS_HELP_STRING([--disable-ipv6-support], [Disable IPv6 support]))
-AM_CONDITIONAL(WITH_INET6, test "x${enable_ipv6_support}" != "xno")
-AM_COND_IF([WITH_INET6],
- AC_DEFINE(INET6, 1, ["Have IPv6 support"]))
+AC_ARG_ENABLE([ipv6cp],
+ AS_HELP_STRING([--disable-ipv6cp], [Disable IPv6 Control Protocol]))
+AM_CONDITIONAL(PPP_WITH_IPV6CP, test "x${enable_ipv6cp}" != "xno")
+AM_COND_IF([PPP_WITH_IPV6CP],
+ AC_DEFINE(PPP_WITH_IPV6CP, 1, [Have IPv6 Control Protocol]))
#
# Disable Multilink support
AC_ARG_ENABLE([multilink],
AS_HELP_STRING([--enable-multilink], [Enable multilink support]))
-AM_CONDITIONAL(WITH_MULTILINK, test "x${enable_multilink}" = "xyes")
-AM_COND_IF([WITH_MULTILINK],
- AC_DEFINE([HAVE_MULTILINK], 1, ["Have multilink support"]))
+AM_CONDITIONAL(PPP_WITH_MULTILINK, test "x${enable_multilink}" = "xyes")
+AM_COND_IF([PPP_WITH_MULTILINK],
+ AC_DEFINE([PPP_WITH_MULTILINK], 1, [Have multilink support]))
AS_IF([test "x${build_sunos}" = "xyes" && test "x${enable_multilink}" = "xyes"],
[AC_MSG_ERROR([Multilink is not supported on SunOS])])
#
# Multilink require Trivial Database Support
-AM_CONDITIONAL(WITH_TDB, test "x${enable_multilink}" = "xyes")
-AM_COND_IF([WITH_TDB],
- AC_DEFINE([USE_TDB], 1, ["Include TDB support"]))
+AM_CONDITIONAL(PPP_WITH_TDB, test "x${enable_multilink}" = "xyes")
+AM_COND_IF([PPP_WITH_TDB],
+ AC_DEFINE([PPP_WITH_TDB], 1, [Include TDB support]))
#
# Enable support for loadable plugins
AC_ARG_ENABLE([plugins],
AS_HELP_STRING([--disable-plugins], [Disable support for loadable plugins]))
AS_IF([test "x$enable_plugins" != "xno"],
- AC_DEFINE([PLUGIN], 1, ["Have support for loadable plugins"]))
-AM_CONDITIONAL(WITH_PLUGINS, test "${enable_plugins}" != "no")
+ AC_DEFINE([PPP_WITH_PLUGINS], 1, [Have support for loadable plugins]))
+AM_CONDITIONAL(PPP_WITH_PLUGINS, test "x${enable_plugins}" != "xno")
#
# Disable EAP-TLS support
AC_ARG_ENABLE([eaptls],
AS_HELP_STRING([--disable-eaptls], [Disable EAP-TLS authentication support]))
AS_IF([test "x$enable_eaptls" != "xno"],
- AC_DEFINE([USE_EAPTLS], 1, ["Have EAP-TLS authentication support"]))
-AM_CONDITIONAL(WITH_EAPTLS, test "x${enable_eaptls}" != "xno")
+ AC_DEFINE([PPP_WITH_EAPTLS], 1, [Have EAP-TLS authentication support]))
+AM_CONDITIONAL(PPP_WITH_EAPTLS, test "x${enable_eaptls}" != "xno")
#
# Disable PEAP support
AC_ARG_ENABLE([peap],
AS_HELP_STRING([--disable-peap], [Disable PEAP authentication support]))
AS_IF([test "x${enable_peap}" != "xno"],
- AC_DEFINE([USE_PEAP], 1, ["Have PEAP authentication support"]))
-AM_CONDITIONAL([WITH_PEAP], test "x${enable_peap}" != "xno")
+ AC_DEFINE([PPP_WITH_PEAP], 1, [Have PEAP authentication support]))
+AM_CONDITIONAL([PPP_WITH_PEAP], test "x${enable_peap}" != "xno")
#
# Disable OpenSSL engine support
AC_ARG_ENABLE([openssl-engine],
AS_HELP_STRING([--disable-openssl-engine], [Disable OpenSSL engine support]))
AS_IF([test "x$enable_openssl_engine" != "xno"], [],
- AC_DEFINE([OPENSSL_NO_ENGINE], 1, ["OpenSSL engine support"]))
+ AC_DEFINE([OPENSSL_NO_ENGINE], 1, [OpenSSL engine support]))
#
# Specify runtime directory
#
# Check for OpenSSL
AX_CHECK_OPENSSL
-AM_CONDITIONAL(WITH_OPENSSL, test "${with_openssl}" != "no")
+AM_CONDITIONAL(WITH_OPENSSL, test "x${with_openssl}" != "xno")
#
# Check if OpenSSL has compiled in support for various ciphers
AM_CONDITIONAL([OPENSSL_HAVE_MD4], test "x${ac_cv_openssl_md4}" = "xyes")
AM_COND_IF([OPENSSL_HAVE_MD4],,
- AC_DEFINE([USE_MD4], 1, [Use included md4 included with pppd]))
+ AC_DEFINE([USE_MD4], 1, [Use MD4 included with pppd]))
AM_CONDITIONAL([OPENSSL_HAVE_MD5], test "x${ac_cv_openssl_md5}" = "xyes")
AM_COND_IF([OPENSSL_HAVE_MD5],,
- AC_DEFINE([USE_MD5], 1, [Use included md5 included with pppd]))
+ AC_DEFINE([USE_MD5], 1, [Use MD5 included with pppd]))
AM_CONDITIONAL([OPENSSL_HAVE_SHA], test "x${ac_cv_openssl_sha}" = "xyes")
AM_COND_IF([OPENSSL_HAVE_SHA],,
- AC_DEFINE([USE_SHA], 1, [Use included sha included with pppd]))
+ AC_DEFINE([USE_SHA], 1, [Use SHA included with pppd]))
AM_CONDITIONAL([OPENSSL_HAVE_DES], test "x${ac_cv_openssl_des}" = "xyes")
AM_COND_IF([OPENSSL_HAVE_DES],,
- AC_DEFINE([USE_CRYPT], 1, [Use included des included with pppd]))
+ AC_DEFINE([USE_CRYPT], 1, [Use DES included with pppd]))
#
# If OpenSSL doesn't support DES, then use the one from libcrypt (glibc dropped support for this in 2.27).
-AS_IF([test "${ac_cv_openssl_des}" = "no" ], [
+AS_IF([test "x${ac_cv_openssl_des}" = "xno" ], [
AC_CHECK_LIB([crypt], [encrypt],
[LIBS="$LIBS -lcrypt"],
[AC_MSG_ERROR([OpenSSL not found or does not support DES, and libcrypt also doesn't support encrypt])]
#
# With libsrp support
-AX_CHECK_SRP
+AX_CHECK_SRP([
+ AC_DEFINE([PPP_WITH_SRP], 1, [Support for libsrp authentication module])])
#
# With libatm support
#
# With libpam support
-AX_CHECK_PAM(AC_DEFINE([USE_PAM], 1, ["Support for Pluggable Authentication Modules"]))
-AM_CONDITIONAL(WITH_PAM, test "x${with_pam}" = "xyes")
+AX_CHECK_PAM(AC_DEFINE([PPP_WITH_PAM], 1, [Support for Pluggable Authentication Modules]))
+AM_CONDITIONAL(PPP_WITH_PAM, test "x${with_pam}" = "xyes")
#
# With libpcap support, activate pppd on network activity
#
# SunOS provides a version of libpcap that would work, but SunOS has no support for activity filter
-AM_CONDITIONAL([WITH_FILTER], [ test "x${with_pcap}" = "xyes" && test "x${build_sunos}" != "xyes" ])
-AM_COND_IF([WITH_FILTER], [
- AC_DEFINE([PPP_FILTER], 1, ["Have packet activity filter support"])], [
+AM_CONDITIONAL([PPP_WITH_FILTER], [ test "x${with_pcap}" = "xyes" && test "x${build_sunos}" != "xyes" ])
+AM_COND_IF([PPP_WITH_FILTER], [
+ AC_DEFINE([PPP_WITH_FILTER], 1, [Have packet activity filter support])], [
AS_IF([test "x${build_sunos}" = "xyes"], [
AC_MSG_WARN([Packet activity filter not supported on SunOS])
with_pcap="no"
fi
AM_CONDITIONAL([WITH_GTK], test "x${with_gtk}" = "xyes")
+AC_DEFINE_UNQUOTED(PPPD_VERSION, "$VERSION", [Version of pppd])
AC_CONFIG_FILES([
Makefile
Multilink............: ${enable_multilink:-no}
Plugins..............: ${enable_plugins:-yes}
CBCP.................: ${enable_cbcp:-no}
+ IPV6CP...............: ${enable_ipv6cp:-yes}
EAP-TLS..............: ${enable_eaptls:-yes}
PEAP.................: ${enable_peap:-yes}
+ systemd notifications: ${enable_systemd:-no}
"
#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
#define PPPIOCGIDLE _IOR('t', 74, struct ppp_idle) /* get idle time */
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */
#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */
-#endif /* PPP_FILTER */
+#endif /* PPP_WITH_FILTER */
/* PPPIOC[GS]MTU are alternatives to SIOC[GS]IFMTU, used under Ultrix */
#define PPPIOCGMTU _IOR('t', 73, int) /* get interface MTU */
$1
], [
AC_MSG_RESULT([no])
- with_atm=""
+ with_atm="no"
$2
])
CPPFLAGS="$save_CPPFLAGS"
AC_SUBST([ATM_LIBS])
AC_SUBST([ATM_LDFLAGS])
fi
- AM_CONDITIONAL(WITH_LIBATM, test -n "${with_atm}")
+ AM_CONDITIONAL(WITH_LIBATM, test "x${with_atm}" != "xno")
])
$1
], [
AC_MSG_RESULT([no])
- with_pam=""
+ with_pam="no"
$2
])
CPPFLAGS="$save_CPPFLAGS"
AC_SUBST([PAM_LIBS])
AC_SUBST([PAM_LDFLAGS])
fi
- AM_CONDITIONAL(WITH_LIBPAM, test -n "${with_pam}")
+ AM_CONDITIONAL(WITH_LIBPAM, test "x${with_pam}" != "xno")
])
$1
], [
AC_MSG_RESULT([no])
- with_pcap=""
+ with_pcap="no"
$2
])
CPPFLAGS="$save_CPPFLAGS"
AC_SUBST([PCAP_LDFLAGS])
fi
- AM_CONDITIONAL(WITH_PCAP, test -n "${with_pcap}")
+ AM_CONDITIONAL(WITH_PCAP, test "x${with_pcap}" != "xno")
])
$1
], [
AC_MSG_RESULT([no])
- with_srp=""
+ with_srp="no"
$2
])
CPPFLAGS="$save_CPPFLAGS"
AC_SUBST([SRP_LDFLAGS])
fi
- AM_CONDITIONAL(WITH_SRP, test -n "${with_srp}")
+ AM_CONDITIONAL(WITH_SRP, test "x${with_srp}" != "xno")
])
utest_chap_LDFLAGS =
utest_peap_SOURCES = peap.c utils.c mppe.c
-utest_peap_CPPFLAGS = -DUNIT_TEST -I${top_srcdir}/include
+utest_peap_CPPFLAGS = -DUNIT_TEST
utest_peap_LDFLAGS =
if WITH_SRP
md4.h \
md5.h \
mppe.h \
- patchlevel.h \
pathnames.h \
peap.h \
pppcrypt.h \
upap.c \
utils.c
-pppd_CPPFLAGS = -I${top_srcdir}/include -DPPPD_RUNTIME_DIR='"@PPPD_RUNTIME_DIR@"' -DPPPD_LOGFILE_DIR='"@PPPD_LOGFILE_DIR@"'
+pppd_CPPFLAGS = -DPPPD_RUNTIME_DIR='"@PPPD_RUNTIME_DIR@"' -DPPPD_LOGFILE_DIR='"@PPPD_LOGFILE_DIR@"'
pppd_LDFLAGS =
pppd_LIBS =
if SUNOS
pppd_SOURCES += sys-solaris.c
+pppd_CPPFLAGS += -I${top_srcdir}/include
pppd_LIBS += -lsocket -lnsl
endif
-if WITH_CHAPMS
+if PPP_WITH_CHAPMS
pppd_SOURCES += chap_ms.c
pppd_SOURCES += pppcrypt.c
check_PROGRAMS += utest_chap
endif
endif
-if WITH_CBCP
+if PPP_WITH_CBCP
pppd_SOURCES += cbcp.c
endif
-if WITH_MPPE
+if PPP_WITH_MPPE
pppd_SOURCES += mppe.c
endif
-if WITH_FILTER
+if PPP_WITH_FILTER
pppd_CPPFLAGS += $(PCAP_CFLAGS)
pppd_LDFLAGS += $(PCAP_LDFLAGS)
pppd_LIBS += $(PCAP_LIBS)
endif
-if WITH_PLUGINS
+if PPP_WITH_PLUGINS
pppd_CPPFLAGS += -DPPPD_PLUGIN_DIR='"@PPPD_PLUGIN_DIR@"'
pppd_LIBS += -ldl
if LINUX
endif
endif
-if WITH_MULTILINK
+if PPP_WITH_MULTILINK
pppd_SOURCES += multilink.c
endif
-if WITH_TDB
+if PPP_WITH_TDB
pppd_SOURCES += tdb.c spinlock.c
endif
-if WITH_INET6
+if PPP_WITH_IPV6CP
pppd_SOURCES += ipv6cp.c eui64.c
endif
-if WITH_PAM
-pppd_LIBS += -lpam -ldl
+if PPP_WITH_PAM
+pppd_CPPFLAGS += $(PAM_CFLAGS)
+pppd_LIBS += $(PAM_LIBS) -ldl
+pppd_LDFLAGS += $(PAM_LDFLAGS)
endif
-if WITH_EAPTLS
+if PPP_WITH_EAPTLS
pppd_SOURCES += eap-tls.c tls.c
else
-if WITH_PEAP
+if PPP_WITH_PEAP
pppd_SOURCES += tls.c
endif
endif
-if WITH_PEAP
+if PPP_WITH_PEAP
pppd_SOURCES += peap.c
check_PROGRAMS += utest_peap
endif
pppd_LIBS += libppp_crypt.la
if WITH_SYSTEMD
-pppd_LIBS += -lsystemd
+pppd_CPPFLAGS += $(SYSTEMD_CFLAGS)
+pppd_LIBS += $(SYSTEMD_LIBS)
endif
if WITH_SRP
#include "upap.h"
#include "chap-new.h"
#include "eap.h"
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
#include "eap-tls.h"
#endif
-#ifdef CBCP_SUPPORT
+#ifdef PPP_WITH_CBCP
#include "cbcp.h"
#endif
#include "pathnames.h"
/* Hook for a plugin to get the CHAP password for authenticating us */
int (*chap_passwd_hook)(char *user, char *passwd) = NULL;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
/* Hook for a plugin to get the EAP-TLS password for authenticating us */
int (*eaptls_passwd_hook)(char *user, char *passwd) = NULL;
#endif
int (*allowed_address_hook)(u_int32_t addr) = NULL;
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
/* Hook for plugin to hear when an interface joins a multilink bundle */
void (*multilink_join_hook)(void) = NULL;
#endif
bool refuse_pap = 0; /* Don't wanna auth. ourselves with PAP */
bool refuse_chap = 0; /* Don't wanna auth. ourselves with CHAP */
bool refuse_eap = 0; /* Don't wanna auth. ourselves with EAP */
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
bool refuse_mschap = 0; /* Don't wanna auth. ourselves with MS-CHAP */
bool refuse_mschap_v2 = 0; /* Don't wanna auth. ourselves with MS-CHAPv2 */
#else
bool explicit_passwd = 0; /* Set if "password" option supplied */
char remote_name[MAXNAMELEN]; /* Peer's name for authentication */
-#if defined(USE_EAPTLS) || defined(USE_PEAP)
+#if defined(PPP_WITH_EAPTLS) || defined(PPP_WITH_PEAP)
char *cacert_file = NULL; /* CA certificate file (pem format) */
char *ca_path = NULL; /* Directory with CA certificates */
char *crl_dir = NULL; /* Directory containing CRL files */
bool tls_verify_key_usage = 0; /* Verify peer certificate key usage */
#endif
-#if defined(USE_EAPTLS)
+#if defined(PPP_WITH_EAPTLS)
char *cert_file = NULL; /* Client certificate file (pem format) */
char *privkey_file = NULL; /* Client private key file (pem format) */
char *pkcs12_file = NULL; /* Client private key envelope file (pkcs12 format) */
static int have_srp_secret(char *client, char *server, int need_ip,
int *lacks_ipp);
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
static int have_eaptls_secret_server
(char *client, char *server, int need_ip, int *lacks_ipp);
static int have_eaptls_secret_client (char *client, char *server);
static int set_permitted_number (char **);
static void check_access (FILE *, char *);
static int wordlist_count (struct wordlist *);
-
-#ifdef MAXOCTETS
static void check_maxoctets (void *);
-#endif
/*
* Authentication-related options.
"Require CHAP authentication from peer",
OPT_ALIAS | OPT_PRIOSUB | OPT_A2OR | MDTYPE_MD5,
&lcp_wantoptions[0].chap_mdtype },
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
{ "require-mschap", o_bool, &auth_required,
"Require MS-CHAP authentication from peer",
OPT_PRIOSUB | OPT_A2OR | MDTYPE_MICROSOFT,
"Don't allow CHAP authentication with peer",
OPT_ALIAS | OPT_A2CLRB | MDTYPE_MD5,
&lcp_allowoptions[0].chap_mdtype },
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
{ "refuse-mschap", o_bool, &refuse_mschap,
"Don't agree to auth to peer with MS-CHAP",
OPT_A2CLRB | MDTYPE_MICROSOFT,
"Set telephone number(s) which are allowed to connect",
OPT_PRIV | OPT_A2LIST },
-#if defined(USE_EAPTLS) || defined(USE_PEAP)
+#if defined(PPP_WITH_EAPTLS) || defined(PPP_WITH_PEAP)
{ "ca", o_string, &cacert_file, "CA certificate in PEM format" },
{ "capath", o_string, &ca_path, "TLS CA certificate directory" },
{ "crl-dir", o_string, &crl_dir, "Use CRLs in directory" },
"Verify peer by method (none|subject|name|suffix)" },
#endif
-#if defined(USE_EAPTLS)
+#if defined(PPP_WITH_EAPTLS)
{ "cert", o_string, &cert_file, "client certificate in PEM format" },
{ "key", o_string, &privkey_file, "client private key in PEM format" },
{ "pkcs12", o_string, &pkcs12_file, "EAP-TLS client credentials in PKCS12 format" },
{ "need-peer-eap", o_bool, &need_peer_eap,
"Require the peer to authenticate us", 1 },
-#endif
+#endif /* PPP_WITH_EAPTLS */
{ NULL }
};
lcp_options *wo = &lcp_wantoptions[unit];
lcp_options *go = &lcp_gotoptions[unit];
lcp_options *ho = &lcp_hisoptions[unit];
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
lcp_options *ao = &lcp_allowoptions[unit];
#endif
int i;
}
}
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
if (need_peer_eap && !ao->neg_eap) {
warn("eap required to authenticate us but no suitable secrets");
lcp_close(unit, "couldn't negotiate eap");
}
}
-#ifdef CBCP_SUPPORT
+#ifdef PPP_WITH_CBCP
/*
* If we negotiated callback, do it now.
*/
new_phase(PHASE_NETWORK);
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
if (multilink) {
if (mp_join_bundle()) {
if (multilink_join_hook)
return;
}
}
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
if (!demand)
set_filters(&pass_filter, &active_filter);
#endif
case CHAP_MD5:
bit |= CHAP_MD5_PEER;
break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case CHAP_MICROSOFT:
bit |= CHAP_MS_PEER;
break;
case CHAP_MD5:
bit |= CHAP_MD5_WITHPEER;
break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case CHAP_MICROSOFT:
bit |= CHAP_MS_WITHPEER;
break;
if (maxconnect > 0)
TIMEOUT(connect_time_expired, 0, maxconnect);
-#ifdef MAXOCTETS
if (maxoctets > 0)
TIMEOUT(check_maxoctets, NULL, maxoctets_timeout);
-#endif
/*
* Detach now, if the updetach option was given.
if (--num_np_up == 0) {
UNTIMEOUT(check_idle, NULL);
UNTIMEOUT(connect_time_expired, NULL);
-#ifdef MAXOCTETS
UNTIMEOUT(check_maxoctets, NULL);
-#endif
new_phase(PHASE_NETWORK);
}
}
}
}
-#ifdef MAXOCTETS
static void
check_maxoctets(void *arg)
{
TIMEOUT(check_maxoctets, NULL, maxoctets_timeout);
}
}
-#endif
/*
* check_idle - check whether the link has been idle for long
our_name, 1, &lacks_ip);
}
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
if (!can_auth && wo->neg_eap) {
can_auth =
have_eaptls_secret_server((explicit_remote ? remote_name :
(hadchap == 1 || (hadchap == -1 && have_chap_secret(user,
(explicit_remote? remote_name: NULL), 0, NULL))) ||
have_srp_secret(user, (explicit_remote? remote_name: NULL), 0, NULL)
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
|| have_eaptls_secret_client(user, (explicit_remote? remote_name: NULL))
#endif
);
1, NULL))) &&
!have_srp_secret((explicit_remote? remote_name: NULL), our_name, 1,
NULL)
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
&& !have_eaptls_secret_server((explicit_remote? remote_name: NULL),
our_name, 1, NULL)
#endif
}
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
static int
have_eaptls_secret_server(char *client, char *server,
int need_ip, int *lacks_ipp)
#include <stdlib.h>
#include <string.h>
+#if defined(SOL2)
+#include <net/ppp-comp.h>
+#else
+#include <linux/ppp-comp.h>
+#endif
#include "pppd.h"
#include "fsm.h"
#include "ccp.h"
-#include <net/ppp-comp.h>
#include "chap_ms.h"
#include "mppe.h"
/*
* Option variables.
*/
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
bool refuse_mppe_stateful = 1; /* Allow stateful mode? */
#endif
"don't allow Predictor-1", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
&ccp_allowoptions[0].predictor_1 },
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
/* MPPE options are symmetrical ... we only set wantoptions here */
{ "require-mppe", o_bool, &ccp_wantoptions[0].mppe,
"require MPPE encryption",
fsm_input(f, p, len);
if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED) {
notice("Compression disabled by peer.");
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (ccp_gotoptions[unit].mppe) {
error("MPPE disabled, closing LCP");
lcp_close(unit, "MPPE disabled by peer");
ccp_flags_set(unit, 0, 0);
fsm_lowerdown(&ccp_fsm[unit]);
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (ccp_gotoptions[unit].mppe) {
error("MPPE required but peer negotiation failed");
lcp_close(unit, "MPPE required but peer negotiation failed");
*go = ccp_wantoptions[f->unit];
all_rejected[f->unit] = 0;
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (go->mppe) {
ccp_options *ao = &ccp_allowoptions[f->unit];
int auth_mschap_bits = auth_done[f->unit];
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
int auth_eap_bits = auth_done[f->unit];
#endif
int numbits;
return;
}
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
/*
* MPPE is also possible in combination with EAP-TLS.
* It is not possible to detect if we're doing EAP or EAP-TLS
ao->predictor_2 = go->predictor_2 = 0;
ao->deflate = go->deflate = 0;
}
-#endif /* MPPE */
/*
* Check whether the kernel knows about the various
* compression methods we might request.
*/
-#ifdef MPPE
if (go->mppe) {
opt_buf[0] = CI_MPPE;
opt_buf[1] = CILEN_MPPE;
lcp_close(f->unit, "MPPE required but not available");
}
}
-#endif
+#endif /* PPP_WITH_MPPE */
if (go->bsd_compress) {
opt_buf[0] = CI_BSD_COMPRESS;
opt_buf[1] = CILEN_BSD_COMPRESS;
* preference order. Get the kernel to allocate the first one
* in case it gets Acked.
*/
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (go->mppe) {
u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN];
ccp_options *go = &ccp_gotoptions[f->unit];
u_char *p0 = p;
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (go->mppe) {
u_char opt_buf[CILEN_MPPE];
memset(&no, 0, sizeof(no));
try = *go;
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (go->mppe && len >= CILEN_MPPE
&& p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
no.mppe = 1;
lcp_close(f->unit, "MPPE required but peer negotiation failed");
}
}
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
if (go->deflate && len >= CILEN_DEFLATE
&& p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
&& p[1] == CILEN_DEFLATE) {
if (len == 0 && all_rejected[f->unit])
return -1;
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (go->mppe && len >= CILEN_MPPE
&& p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
error("MPPE required but peer refused");
int len, clen, type, nb;
ccp_options *ho = &ccp_hisoptions[f->unit];
ccp_options *ao = &ccp_allowoptions[f->unit];
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
bool rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */
/* CI_MPPE, or due to other options? */
#endif
clen = p[1];
switch (type) {
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
case CI_MPPE:
if (!ao->mppe || clen != CILEN_MPPE) {
newret = CONFREJ;
*/
rej_for_ci_mppe = 0;
break;
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
case CI_DEFLATE:
case CI_DEFLATE_DRAFT:
if (!ao->deflate || clen != CILEN_DEFLATE
else
*lenp = retp - p0;
}
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) {
error("MPPE required but peer negotiation failed");
lcp_close(f->unit, "MPPE required but peer negotiation failed");
if (!ANY_COMPRESS(*opt))
return "(none)";
switch (opt->method) {
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
case CI_MPPE:
{
char *p = result;
notice("%s receive compression enabled", method_name(go, NULL));
} else if (ANY_COMPRESS(*ho))
notice("%s transmit compression enabled", method_name(ho, NULL));
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (go->mppe) {
mppe_clear_keys();
continue_networks(f->unit); /* Bring up IP et al */
UNTIMEOUT(ccp_rack_timeout, f);
ccp_localstate[f->unit] = 0;
ccp_flags_set(f->unit, 1, 0);
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
if (ccp_gotoptions[f->unit].mppe) {
ccp_gotoptions[f->unit].mppe = 0;
if (lcp_fsm[f->unit].state == OPENED) {
len -= optlen;
optend = p + optlen;
switch (code) {
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
case CI_MPPE:
if (optlen >= CILEN_MPPE) {
u_char mppe_opts;
*/
error("Lost compression sync: disabling compression");
ccp_close(unit, "Lost compression sync");
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
/*
* If we were doing MPPE, we must also take the link down.
*/
*
* $Id: ccp.h,v 1.12 2004/11/04 10:02:26 paulus Exp $
*/
+#ifndef PPP_CCP_H
+#define PPP_CCP_H
+
#include "pppdconf.h"
typedef struct ccp_options {
extern ccp_options ccp_hisoptions[];
extern struct protent ccp_protent;
+
+#endif
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
+#ifndef PPP_CHAP_MD5_H
+#define PPP_CHAP_MD5_H
+
#include "pppdconf.h"
extern void chap_md5_init(void);
+
+#endif
#include "chap-new.h"
#include "chap-md5.h"
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
#include "chap_ms.h"
#define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5)
#else
memset(&server, 0, sizeof(server));
chap_md5_init();
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
chapms_init();
#endif
}
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef PPP_CHAP_NEW_H
+#define PPP_CHAP_NEW_H
+
#include "pppdconf.h"
/*
/* Represents the CHAP protocol to the main pppd code */
extern struct protent chap_protent;
+
+#endif
#include "config.h"
#endif
-#ifdef CHAPMS
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
+#if defined(SOL2)
+#include <net/ppp-comp.h>
+#else
+#include <linux/ppp-comp.h>
+#endif
#include "pppd.h"
#include "chap-new.h"
#include "mppe.h"
#ifdef UNIT_TEST
-#undef MPPE
+#undef PPP_WITH_MPPE
#endif
static void ascii2unicode (char[], int, u_char[]);
static void GenerateAuthenticatorResponsePlain
(char*, int, u_char[24], u_char[16], u_char *,
char *, u_char[41]);
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
static void ChapMS_LANMan (u_char *, char *, int, u_char *);
#endif
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
bool ms_lanman = 0; /* Use LanMan password instead of NT */
/* Has meaning only with MS-CHAP challenges */
#endif
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
#ifdef DEBUGMPPEKEY
/* For MPPE debug */
/* Use "[]|}{?/><,`!2&&(" (sans quotes) for RFC 3079 MS-CHAPv2 test value */
#include "fsm.h" /* Need to poke MPPE options */
#include "ccp.h"
-#include <net/ppp-comp.h>
#endif
/*
* Command-line options.
*/
static option_t chapms_option_list[] = {
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
{ "ms-lanman", o_bool, &ms_lanman,
"Use LanMan passwd when using MS-CHAP", 1 },
#endif
if (response_len != MS_CHAP_RESPONSE_LEN)
goto bad;
-#ifndef MSLANMAN
+#ifndef PPP_WITH_MSLANMAN
if (!response[MS_CHAP_USENT]) {
/* Should really propagate this into the error packet. */
notice("Peer request for LANMAN auth not supported");
/* Generate the expected response. */
ChapMS(challenge, (char *)secret, secret_len, md);
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
/* Determine which part of response to verify against */
if (!response[MS_CHAP_USENT])
diff = memcmp(&response[MS_CHAP_LANMANRESP],
ChallengeResponse(Challenge, PasswordHash, NTResponse);
}
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */
static void
}
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
/*
* Set mppe_xxxx_key from MS-CHAP credentials. (see RFC 3079)
mppe_set_chapv2(PasswordHashHash, NTResponse, IsServer);
}
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
void
ChapMS_NT(rchallenge, secret, secret_len, &response[MS_CHAP_NTRESP]);
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
ChapMS_LANMan(rchallenge, secret, secret_len,
&response[MS_CHAP_LANMANRESP]);
response[MS_CHAP_USENT] = 1;
#endif
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
Set_Start_Key(rchallenge, secret, secret_len);
#endif
}
&response[MS_CHAP2_PEER_CHALLENGE],
rchallenge, user, authResponse);
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
SetMasterKeys(secret, secret_len,
&response[MS_CHAP2_NTRESP], authenticator);
#endif
#endif /* UNIT_TEST */
-
-#endif /* CHAPMS */
* $Id: chap_ms.h,v 1.13 2004/11/15 22:13:26 paulus Exp $
*/
-#include "pppdconf.h"
+#ifndef PPP_CHAPMS_H
+#define PPP_CHAPMS_H
-#ifndef __CHAPMS_INCLUDE__
+#include "pppdconf.h"
#define MD4_SIGNATURE_SIZE 16 /* 16 bytes in a MD4 message digest */
#define MAX_NT_PASSWORD 256 /* Max (Unicode) chars in an NT pass */
void chapms_init(void);
-#define __CHAPMS_INCLUDE__
-#endif /* __CHAPMS_INCLUDE__ */
+#endif /* PPP_CHAPMS_H */
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/socket.h>
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
#include <pcap-bpf.h>
#endif
|| ppp_recv_config(0, PPP_MRU, (u_int32_t) 0, 0, 0) < 0)
fatal("Couldn't set up demand-dialled PPP interface: %m");
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
set_filters(&pass_filter, &active_filter);
#endif
0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
};
+#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
/*
* loop_chars - process characters received from the loopback.
if (len < PPP_HDRLEN)
return 0;
proto = PPP_PROTOCOL(p);
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
p[0] = 1; /* outbound packet indicator */
if ((pass_filter.bf_len != 0
&& bpf_filter(pass_filter.bf_insns, p, len, len) == 0)
size_t len, SSL * ssl, void *arg);
int ssl_new_session_cb(SSL *s, SSL_SESSION *sess);
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
#define EAPTLS_MPPE_KEY_LEN 32
/*
}
}
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
int password_callback (char *buf, int size, int rwflag, void *u)
{
*
*/
-#include "pppdconf.h"
-
-#ifndef __EAP_TLS_H__
-#define __EAP_TLS_H__
+#ifndef PPP_EAP_TLS_H
+#define PPP_EAP_TLS_H
+#include "pppdconf.h"
#include "eap.h"
#include <openssl/ssl.h>
char *clicertfile, char *servcertfile, char *cacertfile,
char *capath, char *pkfile, char *pkcs12, int am_server);
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
void eaptls_gen_mppe_keys(struct eaptls_session *ets, int client);
#endif
#include "pathnames.h"
#include "md5.h"
#include "eap.h"
-#ifdef USE_PEAP
+#ifdef PPP_WITH_PEAP
#include "peap.h"
-#endif /* USE_PEAP */
+#endif /* PPP_WITH_PEAP */
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#include <t_server.h>
#include <t_client.h>
#include "pppcrypt.h"
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
#ifndef SHA_DIGESTSIZE
#define SHA_DIGESTSIZE 20
#endif
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
#include "eap-tls.h"
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
#include "chap_ms.h"
#include "chap-new.h"
extern int chapms_strip_domain;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
eap_state eap_states[NUM_PPP]; /* EAP state; one for each unit */
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
static char *pn_secret = NULL; /* Pseudonym generating secret */
#endif
"Set max number of EAP Requests allows (client)" },
{ "eap-interval", o_int, &eap_states[0].es_rechallenge,
"Set interval for EAP rechallenge" },
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
{ "srp-interval", o_int, &eap_states[0].es_lwrechallenge,
"Set interval for SRP lightweight rechallenge" },
{ "srp-pn-secret", o_string, &pn_secret,
NULL /* say whether to bring up link for this pkt */
};
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
/*
* A well-known 2048 bit modulus.
*/
0x9B, 0x65, 0xE3, 0x72, 0xFC, 0xD6, 0x8E, 0xF2,
0x0F, 0xA7, 0x11, 0x1F, 0x9E, 0x4A, 0xFF, 0x73
};
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
/* Local forward declarations. */
static void eap_server_timeout (void *arg);
esp->es_server.ea_id = (u_char)(drand48() * 0x100);
esp->es_client.ea_timeout = EAP_DEFREQTIME;
esp->es_client.ea_maxrequests = EAP_DEFALLOWREQ;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
esp->es_client.ea_using_eaptls = 0;
-#endif /* USE_EAPTLS */
-#ifdef CHAPMS
+#endif /* PPP_WITH_EAPTLS */
+#ifdef PPP_WITH_CHAPMS
esp->es_client.digest = chap_find_digest(CHAP_MICROSOFT_V2);
esp->es_server.digest = chap_find_digest(CHAP_MICROSOFT_V2);
#endif
esp->es_server.ea_peer, esp->es_server.ea_peerlen);
}
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
/*
* Set DES key according to pseudonym-generating secret and current
* date.
}
return (outlen);
}
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
/*
* Assume that current waiting server state is complete and figure
static void
eap_figure_next_state(eap_state *esp, int status)
{
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
unsigned char secbuf[MAXWORDLEN], clear[8], *sp, *dp;
struct t_pw tpw;
struct t_confent *tce, mytce;
int id, i, plen, toffs;
u_char vals[2];
struct b64state bs;
-#endif /* USE_SRP */
-#ifdef USE_EAPTLS
+#endif /* PPP_WITH_SRP */
+#ifdef PPP_WITH_EAPTLS
struct eaptls_session *ets;
int secret_len;
char secret[MAXWORDLEN];
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
esp->es_server.ea_timeout = esp->es_savedtime;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
esp->es_server.ea_prev_state = esp->es_server.ea_state;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
switch (esp->es_server.ea_state) {
case eapBadAuth:
return;
case eapIdentify:
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
/* Discard any previous session. */
ts = (struct t_server *)esp->es_server.ea_session;
if (ts != NULL) {
esp->es_server.ea_session = NULL;
esp->es_server.ea_skey = NULL;
}
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
if (status != 0) {
esp->es_server.ea_state = eapBadAuth;
break;
}
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
/* If we've got a pseudonym, try to decode to real name. */
if (esp->es_server.ea_peerlen > SRP_PSEUDO_LEN &&
strncmp(esp->es_server.ea_peer, SRP_PSEUDO_ID,
t_servergenexp(ts);
break;
}
-#endif /* USE_SRP */
-#ifdef USE_EAPTLS
+#endif /* PPP_WITH_SRP */
+#ifdef PPP_WITH_EAPTLS
if (!get_secret(esp->es_unit, esp->es_server.ea_peer,
esp->es_server.ea_name, secret, &secret_len, 1)) {
esp->es_server.ea_state = eapTlsStart;
break;
}
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
esp->es_server.ea_state = eapMD5Chall;
break;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
case eapTlsStart:
/* Initialize ssl session */
if(!eaptls_init_ssl_server(esp)) {
case eapTlsSendAlert:
esp->es_server.ea_state = eapTlsRecvAlertAck;
break;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
case eapSRP1:
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
ts = (struct t_server *)esp->es_server.ea_session;
if (ts != NULL && status != 0) {
t_serverclose(ts);
esp->es_server.ea_session = NULL;
esp->es_server.ea_skey = NULL;
}
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
if (status == 1) {
esp->es_server.ea_state = eapMD5Chall;
} else if (status != 0 || esp->es_server.ea_session == NULL) {
break;
case eapSRP2:
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
ts = (struct t_server *)esp->es_server.ea_session;
if (ts != NULL && status != 0) {
t_serverclose(ts);
esp->es_server.ea_session = NULL;
esp->es_server.ea_skey = NULL;
}
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
if (status != 0 || esp->es_server.ea_session == NULL) {
esp->es_server.ea_state = eapBadAuth;
} else {
case eapSRP3:
case eapSRP4:
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
ts = (struct t_server *)esp->es_server.ea_session;
if (ts != NULL && status != 0) {
t_serverclose(ts);
esp->es_server.ea_session = NULL;
esp->es_server.ea_skey = NULL;
}
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
if (status != 0 || esp->es_server.ea_session == NULL) {
esp->es_server.ea_state = eapBadAuth;
} else {
}
break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case eapMSCHAPv2Chall:
#endif
case eapMD5Chall:
if (esp->es_server.ea_state == eapBadAuth)
eap_send_failure(esp);
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
dbglog("EAP id=0x%2x '%s' -> '%s'", esp->es_server.ea_id, eap_state_name(esp->es_server.ea_prev_state), eap_state_name(esp->es_server.ea_state));
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
}
-#if CHAPMS
+#if PPP_WITH_CHAPMS
/*
* eap_chap_verify_response - check whether the peer's response matches
* what we think it should be. Returns 1 if it does (authentication
auth_peer_fail(esp->es_unit, PPP_EAP);
}
}
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
/*
* Format an EAP Request message and send it to the peer. Message
int outlen;
int challen;
char *str;
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
struct t_server *ts;
u_char clear[8], cipher[8], dig[SHA_DIGESTSIZE], *optr, *cp;
int i, j;
struct b64state b64;
SHA1_CTX ctxt;
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
/* Handle both initial auth and restart */
if (esp->es_server.ea_state < eapIdentify &&
INCPTR(esp->es_server.ea_namelen, outp);
break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case eapMSCHAPv2Chall:
esp->es_server.digest->generate_challenge(esp->es_challenge);
challen = esp->es_challenge[0];
esp->es_server.ea_namelen);
INCPTR(esp->es_server.ea_namelen, outp);
break;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
case eapTlsStart:
PUTCHAR(EAPT_TLS, outp);
PUTCHAR(EAP_TLS_FLAGS_START, outp);
eaptls_send(esp->es_server.ea_session, &outp);
eap_figure_next_state(esp, 0);
break;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
case eapSRP1:
PUTCHAR(EAPT_SRP, outp);
PUTCHAR(EAPSRP_CHALLENGE, outp);
BCOPY(esp->es_challenge, outp, esp->es_challen);
INCPTR(esp->es_challen, outp);
break;
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
default:
return;
static void
eap_server_timeout(void *arg)
{
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
u_char *outp;
u_char *lenloc;
int outlen;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
eap_state *esp = (eap_state *) arg;
if (!eap_server_active(esp))
return;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
switch(esp->es_server.ea_prev_state) {
/*
default:
break;
}
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
/* EAP ID number must not change on timeout. */
eap_send_request(esp);
output(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
}
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
/*
* Format and send a SRP EAP Response message.
*/
output(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
}
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
/*
* Send an EAP-TLS response message with tls data
*/
output(esp->es_unit, outpacket_buf, PPP_HDRLEN + outlen);
}
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
static void
eap_send_nak(eap_state *esp, u_char id, u_char type)
output(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
}
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
static char *
name_of_pn_file(void)
{
remove_pn_file();
}
}
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
-#if CHAPMS
+#if PPP_WITH_CHAPMS
/*
* Format and send an CHAPV2-Challenge EAP Response message.
*/
char rhostname[256];
MD5_CTX mdContext;
u_char hash[MD5_SIGNATURE_SIZE];
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
u_char flags;
struct eaptls_session *ets = esp->es_client.ea_session;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
struct t_client *tc;
struct t_num sval, gval, Nval, *Ap, Bval;
u_char vals[2];
SHA1_CTX ctxt;
u_char dig[SHA_DIGESTSIZE];
int fd;
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
/*
* Ignore requests if we're not open
case EAPT_IDENTITY:
if (len > 0)
info("EAP: Identity prompt \"%.*q\"", len, inp);
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
if (esp->es_usepseudo &&
(esp->es_usedpseudo == 0 ||
(esp->es_usedpseudo == 1 &&
remove_pn_file();
esp->es_usedpseudo = 2;
}
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
eap_send_response(esp, id, typenum, (u_char *)esp->es_client.ea_name,
esp->es_client.ea_namelen);
break;
esp->es_client.ea_namelen);
break;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
case EAPT_TLS:
switch(esp->es_client.ea_state) {
/* Check if TLS handshake is finished */
if(eaptls_is_init_finished(ets)) {
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
eaptls_gen_mppe_keys(ets, 1);
#endif
eaptls_free_session(ets);
}
break;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
case EAPT_SRP:
if (len < 1) {
error("EAP: received empty SRP Request");
break;
}
break;
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case EAPT_MSCHAPV2:
if (len < 4) {
error("EAP: received invalid MSCHAPv2 packet, too short");
}
break;
-#endif /* CHAPMS */
-#ifdef USE_PEAP
+#endif /* PPP_WITH_CHAPMS */
+#ifdef PPP_WITH_PEAP
case EAPT_PEAP:
/* Initialize the PEAP context (if not already initialized) */
}
break;
-#endif /* USE_PEAP */
+#endif // PPP_WITH_PEAP
default:
info("EAP: unknown authentication type %d; Naking", typenum);
UNTIMEOUT(eap_client_timeout, (void *)esp);
}
esp->es_client.ea_session = NULL;
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
t_clientclose(tc);
auth_withpeer_fail(esp->es_unit, PPP_EAP);
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
}
/*
char rhostname[256];
MD5_CTX mdContext;
u_char hash[MD5_SIGNATURE_SIZE];
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
struct t_server *ts;
struct t_num A;
SHA1_CTX ctxt;
u_char dig[SHA_DIGESTSIZE];
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
struct eaptls_session *ets;
u_char flags;
-#endif /* USE_EAPTLS */
-#ifdef CHAPMS
+#endif /* PPP_WITH_EAPTLS */
+#ifdef PPP_WITH_CHAPMS
u_char opcode;
int (*chap_verifier)(char *, char *, int, struct chap_digest_type *,
unsigned char *, unsigned char *, char *, int);
char response_message[256];
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
/*
* Ignore responses if we're not open
eap_figure_next_state(esp, 0);
break;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
case EAPT_TLS:
switch(esp->es_server.ea_state) {
GETCHAR(flags, inp);
if(len == 1 && !flags) { /* Ack = ok */
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
eaptls_gen_mppe_keys( esp->es_server.ea_session, 0 );
#endif
eap_send_success(esp);
break;
}
break;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
case EAPT_NOTIFICATION:
dbglog("EAP unexpected Notification; response discarded");
esp->es_server.ea_state = eapMD5Chall;
break;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
/* Send EAP-TLS start packet */
case EAPT_TLS:
esp->es_server.ea_state = eapTlsStart;
break;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case EAPT_MSCHAPV2:
info("EAP: peer proposes MSCHAPv2");
/* If MSCHAPv2 digest was not found, NAK the packet */
}
esp->es_server.ea_state = eapMSCHAPv2Chall;
break;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
default:
dbglog("EAP: peer requesting unknown Type %d", vallen);
TIMEOUT(eap_rechallenge, esp, esp->es_rechallenge);
break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case EAPT_MSCHAPV2:
if (len < 1) {
error("EAP: received MSCHAPv2 with no data");
}
break;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
case EAPT_SRP:
if (len < 1) {
error("EAP: empty SRP Response");
break;
}
break;
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
default:
/* This can't happen. */
eap_success(eap_state *esp, u_char *inp, int id, int len)
{
if (esp->es_client.ea_state != eapOpen && !eap_client_active(esp)
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
&& esp->es_client.ea_state != eapTlsRecvSuccess
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
) {
dbglog("EAP unexpected success message in state %s (%d)",
eap_state_name(esp->es_client.ea_state),
return;
}
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
if(esp->es_client.ea_using_eaptls && esp->es_client.ea_state !=
eapTlsRecvSuccess) {
dbglog("EAP-TLS unexpected success message in state %s (%d)",
esp->es_client.ea_state);
return;
}
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
if (esp->es_client.ea_timeout > 0) {
UNTIMEOUT(eap_client_timeout, (void *)esp);
PRINTMSG(inp, len);
}
-#ifdef USE_PEAP
+#ifdef PPP_WITH_PEAP
peap_finish(&esp->ea_peap);
#endif
error("EAP: peer reports authentication failure");
-#ifdef USE_PEAP
+#ifdef PPP_WITH_PEAP
peap_finish(&esp->ea_peap);
#endif
int code, id, len, rtype, vallen;
u_char *pstart;
u_int32_t uval;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
u_char flags;
-#endif /* USE_EAPTLS */
-#ifdef CHAPMS
+#endif /* PPP_WITH_EAPTLS */
+#ifdef PPP_WITH_CHAPMS
u_char opcode;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
if (inlen < EAP_HEADERLEN)
return (0);
}
break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case EAPT_MSCHAPV2:
if (len <= 0)
break;
break;
}
break;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
case EAPT_TLS:
if (len < 1)
break;
printer(arg, flags & EAP_TLS_FLAGS_MF ? "M":"-");
printer(arg, flags & EAP_TLS_FLAGS_START ? "S":"- ");
break;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
case EAPT_SRP:
if (len < 3)
goto truncated;
break;
}
break;
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
}
break;
}
break;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
case EAPT_TLS:
if (len < 1)
break;
printer(arg, flags & EAP_TLS_FLAGS_START ? "S":"- ");
break;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
case EAPT_NAK:
if (len <= 0) {
}
break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case EAPT_MSCHAPV2:
if (len <= 0)
break;
break;
}
break;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
case EAPT_SRP:
if (len < 1)
goto truncated;
break;
}
break;
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
}
break;
* $Id: eap.h,v 1.2 2003/06/11 23:56:26 paulus Exp $
*/
-#include "pppdconf.h"
-
#ifndef PPP_EAP_H
#define PPP_EAP_H
+#include "pppdconf.h"
+
#ifdef __cplusplus
extern "C" {
#endif
+
+#ifndef PPP_EAP
+#define PPP_EAP 0xc227
+#endif
+
+
/*
* Packet header = Code, id, length.
*/
"TlsSendAlert", "TlsRecvAlertAck" , "TlsRecvSuccess", "TlsRecvFailure", \
"SRP1", "SRP2", "SRP3", "MD5Chall", "MSCHAPv2Chall", "Open", "SRP4", "BadAuth"
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
#define eap_client_active(esp) ((esp)->es_client.ea_state != eapInitial &&\
(esp)->es_client.ea_state != eapPending &&\
(esp)->es_client.ea_state != eapClosed)
#else
#define eap_client_active(esp) ((esp)->es_client.ea_state == eapListen)
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
#define eap_server_active(esp) \
((esp)->es_server.ea_state >= eapIdentify && \
u_short ea_namelen; /* Length of our name */
u_short ea_peerlen; /* Length of peer's name */
enum eap_state_code ea_state;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
enum eap_state_code ea_prev_state;
#endif
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
struct chap_digest_type *digest;
#endif
u_char ea_id; /* Current id */
u_char ea_responses; /* Number of Responses */
u_char ea_type; /* One of EAPT_* */
u_int32_t ea_keyflags; /* SRP shared key usage flags */
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
bool ea_using_eaptls;
#endif
};
int es_unit; /* Interface unit number */
struct eap_auth es_client; /* Client (authenticatee) data */
struct eap_auth es_server; /* Server (authenticator) data */
-#ifdef USE_PEAP
+#ifdef PPP_WITH_PEAP
struct peap_state *ea_peap; /* Client PEAP (authenticator) data */
#endif
int es_savedtime; /* Saved timeout */
* Timeouts.
*/
#define EAP_DEFTIMEOUT 3 /* Timeout (seconds) for rexmit */
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
#define EAP_DEFTRANSMITS 30 /* max # times to transmit */
/* certificates can be long ... */
#else
#define EAP_DEFTRANSMITS 10 /* max # times to transmit */
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
#define EAP_DEFREQTIME 20 /* Time to wait for peer request */
#define EAP_DEFALLOWREQ 20 /* max # times to accept requests */
*
* $Id: ecp.h,v 1.2 2003/01/10 07:12:36 fcusack Exp $
*/
+#ifndef PPP_ECP_H
+#define PPP_ECP_H
+
#include "pppdconf.h"
+#ifndef PPP_ECP
+#define PPP_ECP 0x8053
+#endif
+
+
typedef struct ecp_options {
bool required; /* Is ECP required? */
unsigned enctype; /* Encryption type */
extern ecp_options ecp_hisoptions[];
extern struct protent ecp_protent;
+
+#endif
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+#ifndef PPP_EUI64_H
+#define PPP_EUI64_H
#include "pppdconf.h"
-#ifndef __EUI64_H__
-#define __EUI64_H__
-
-#if !defined(INET6)
-#error "this file should only be included when INET6 is defined"
-#endif /* not defined(INET6) */
-
-#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;
-
-/*
- * 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) */
+#if !defined(PPP_WITH_IPV6CP)
+#error "this file should only be included when PPP_WITH_IPV6CP is defined"
+#endif /* not defined(PPP_WITH_IPV6CP) */
#define eui64_iszero(e) (((e).e32[0] | (e).e32[1]) == 0)
#define eui64_equals(e, o) (((e).e32[0] == (o).e32[0]) && \
char *eui64_ntoa(eui64_t); /* Returns ascii representation of id */
-#endif /* __EUI64_H__ */
-
+#endif /* PPP_EUI64_H */
*
* $Id: fsm.h,v 1.10 2004/11/13 02:28:15 paulus Exp $
*/
+#ifndef PPP_FSM_H
+#define PPP_FSM_H
#include "pppdconf.h"
* Variables
*/
extern int peer_mru[]; /* currently negotiated peer MRU (per unit) */
+
+#endif
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef PPP_IPCP_H
+#define PPP_IPCP_H
+
#include "pppdconf.h"
/*
char *ip_ntoa(u_int32_t);
extern struct protent ipcp_protent;
+
+#endif /* PPP_IPCP_H */
#include "pppd.h"
#include "fsm.h"
+#include "eui64.h"
#include "ipcp.h"
#include "ipv6cp.h"
#include "magic.h"
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+
+#ifndef PPP_IPV6CP_H
+#define PPP_IPV6CP_H
+
#include "pppdconf.h"
/* Original version, based on RFC2023 :
extern ipv6cp_options ipv6cp_hisoptions[];
extern struct protent ipv6cp_protent;
+
+#endif
#include "pppd.h"
#include "fsm.h"
#include "lcp.h"
+#include "eap.h"
#include "chap-new.h"
#include "magic.h"
static int noopt(char **);
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
static int setendpoint(char **);
static void printendpoint(option_t *, void (*)(void *, char *, ...), void *);
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
static option_t lcp_option_list[] = {
/* LCP options */
{ "receive-all", o_bool, &lax_recv,
"Accept all received control characters", 1 },
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
{ "mrru", o_int, &lcp_wantoptions[0].mrru,
"Maximum received packet size for multilink bundle",
OPT_PRIO, &lcp_wantoptions[0].neg_mrru },
{ "endpoint", o_special, (void *) setendpoint,
"Endpoint discriminator for multilink",
OPT_PRIO | OPT_A2PRINTER, (void *) printendpoint },
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
{ "noendpoint", o_bool, &noendpoint,
"Don't send or accept multilink endpoint discriminator", 1 },
return (1);
}
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
static int
setendpoint(char **argv)
{
{
printer(arg, "%s", epdisc_to_str(&lcp_wantoptions[0].endpoint));
}
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
/*
* lcp_init - Initialize LCP.
*/
mtu = ho->neg_mru? ho->mru: PPP_MRU;
mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU;
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
if (!(multilink && go->neg_mrru && ho->neg_mrru))
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru));
ppp_send_config(f->unit, mtu,
(ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
}
break;
case CI_EPDISC:
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
if (olen >= CILEN_CHAR) {
struct epdisc epd;
p += 2;
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef PPP_LCP_H
+#define PPP_LCP_H
+
#include "pppdconf.h"
/*
/* Default number of times we receive our magic number from the peer
before deciding the link is looped-back. */
#define DEFLOOPBACKFAIL 10
+
+#endif
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef PPP_MAGIC_H
+#define PPP_MAGIC_H
+
#include "pppdconf.h"
void magic_init (void); /* Initialize the magic number generator */
/* Fill buffer with random bytes */
void random_bytes (unsigned char *buf, int len);
+
+#endif
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <limits.h>
#include <inttypes.h>
+#include <net/if.h>
#include "pppd.h"
#include "magic.h"
#include "fsm.h"
#include "lcp.h"
#include "ipcp.h"
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
#include "ipv6cp.h"
#endif
#include "upap.h"
#include "ecp.h"
#include "pathnames.h"
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
#include "tdb.h"
#endif
-#ifdef CBCP_SUPPORT
+#ifdef PPP_WITH_CBCP
#include "cbcp.h"
#endif
concept (eg PPPoE) */
int childwait_done; /* have timed out waiting for children */
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
TDB_CONTEXT *pppdb; /* database for storing status etc. */
#endif
static int reap_kids(void);
static void childwait_end(void *);
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
static void update_db_entry(void);
static void add_db_key(const char *);
static void delete_db_key(const char *);
&lcp_protent,
&pap_protent,
&chap_protent,
-#ifdef CBCP_SUPPORT
+#ifdef PPP_WITH_CBCP
&cbcp_protent,
#endif
&ipcp_protent,
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
&ipv6cp_protent,
#endif
&ccp_protent,
struct protent *protp;
char numbuf[16];
- strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
- strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
+ strlcpy(path_ipup, _PATH_IPUP, MAXPATHLEN);
+ strlcpy(path_ipdown, _PATH_IPDOWN, MAXPATHLEN);
-#ifdef INET6
- strlcpy(path_ipv6up, _PATH_IPV6UP, sizeof(path_ipv6up));
- strlcpy(path_ipv6down, _PATH_IPV6DOWN, sizeof(path_ipv6down));
+#ifdef PPP_WITH_IPV6CP
+ strlcpy(path_ipv6up, _PATH_IPV6UP, MAXPATHLEN);
+ strlcpy(path_ipv6down, _PATH_IPV6DOWN, MAXPATHLEN);
#endif
link_stats_valid = 0;
new_phase(PHASE_INITIALIZE);
if (!sys_check_options())
exit(EXIT_OPTION_ERROR);
auth_check_options();
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
mp_check_options();
#endif
for (i = 0; (protp = protocols[i]) != NULL; ++i)
*/
sys_init();
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
pppdb = tdb_open(_PATH_PPPDB, 0, 0, O_RDWR|O_CREAT, 0644);
if (pppdb != NULL) {
slprintf(db_key, sizeof(db_key), "pppd%d", getpid());
(*the_channel->cleanup)();
remove_pidfiles();
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
if (pppdb != NULL)
cleanup_db();
#endif
/* Executing in the child */
sys_close();
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
if (pppdb != NULL)
tdb_close(pppdb);
#endif
if (script_env != 0) {
for (i = 0; (p = script_env[i]) != 0; ++i) {
if (strncmp(p, var, varl) == 0 && p[varl] == '=') {
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
if (p[-1] && pppdb != NULL)
delete_db_key(p);
#endif
free(p-1);
script_env[i] = newstring;
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
if (pppdb != NULL) {
if (iskey)
add_db_key(newstring);
if (!add_script_env(i, newstring))
return;
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
if (pppdb != NULL) {
if (iskey)
add_db_key(newstring);
return;
for (i = 0; (p = script_env[i]) != 0; ++i) {
if (strncmp(p, var, vl) == 0 && p[vl] == '=') {
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
if (p[-1] && pppdb != NULL)
delete_db_key(p);
#endif
break;
}
}
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
if (pppdb != NULL)
update_db_entry();
#endif
*/
void lock_db(void)
{
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
TDB_DATA key;
key.dptr = PPPD_LOCK_KEY;
*/
void unlock_db(void)
{
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
TDB_DATA key;
key.dptr = PPPD_LOCK_KEY;
#endif
}
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
/*
* update_db_entry - update our entry in the database.
*/
if (p[-1])
delete_db_key(p);
}
-#endif /* USE_TDB */
+#endif /* PPP_WITH_TDB */
** (C) 1990 RSA Data Security, Inc. **
** ********************************************************************
*/
+#ifndef PPP_MD4_H
+#define PPP_MD4_H
+
#include "pppdconf.h"
-#ifndef __MD4_INCLUDE__
-#define __MD4_INCLUDE__
#ifndef USE_MD4
#include <openssl/md4.h>
#define MD4Init MD4_Init
** End of md4.h
****************************(cut)***********************************/
#endif /* USE_MD4 */
-#endif /* __MD4_INCLUDE__ */
+#endif /* PPP_MD4_H */
** documentation and/or software. **
***********************************************************************
*/
+#ifndef PPP_MD5_H
+#define PPP_MD5_H
+
#include "pppdconf.h"
-#ifndef __MD5_INCLUDE__
-#define __MD5_INCLUDE__
#ifndef USE_MD5
#include <openssl/md5.h>
#else
void MD5_Final (unsigned char hash[], MD5_CTX *mdContext);
#endif /* USE_MD5 */
-#endif /* __MD5_INCLUDE__ */
+#endif /* PPP_MD5_H */
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "pppdconf.h"
+#ifndef PPP_MPPE_H
+#define PPP_MPPE_H
-#ifndef __MPPE_H__
-#define __MPPE_H__
+#include "pppdconf.h"
#define MPPE_PAD 4 /* MPPE growth per frame */
#define MPPE_MAX_KEY_SIZE 32 /* Largest key length */
} while (/* CONSTCOND */ 0)
-#if MPPE
+#if PPP_WITH_MPPE
/*
* NOTE:
void mppe_set_chapv2(u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
u_char NTResponse[MS_AUTH_NTRESP_LEN], int IsServer);
-#endif // #ifdef MPPE
-#endif // #ifdef __MPPE_H__
+#endif // #ifdef PPP_WITH_MPPE
+#endif // #ifdef PPP_MPPE_H
#include <syslog.h>
#include <string.h>
#include <pwd.h>
-#ifdef PLUGIN
+#include <sys/param.h>
+#include <net/if.h>
+#ifdef PPP_WITH_PLUGINS
#include <dlfcn.h>
#endif
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
#include <pcap.h>
/*
* There have been 3 or 4 different names for this in libpcap CVS, but
#define DLT_PPP_PPPD DLT_PPP
#endif
#endif
-#endif /* PPP_FILTER */
+#endif /* PPP_WITH_FILTER */
#include "pppd.h"
#include "pathnames.h"
struct userenv *userenv_list; /* user environment variables */
int dfl_route_metric = -1; /* metric of the default route to set over the PPP link */
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */
char path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-down script */
#endif
-#ifdef MAXOCTETS
unsigned int maxoctets = 0; /* default - no limit */
int maxoctets_dir = 0; /* default - sum of traffic */
int maxoctets_timeout = 1; /* default 1 second */
-#endif
extern option_t auth_options[];
extern struct stat devstat;
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
struct bpf_program pass_filter;/* Filter program for packets to pass */
struct bpf_program active_filter; /* Filter program for link-active pkts */
#endif
static int showhelp(char **);
static void usage(void);
static int setlogfile(char **);
-#ifdef PLUGIN
+#ifdef PPP_WITH_PLUGINS
static int loadplugin(char **);
#endif
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
static int setpassfilter(char **);
static int setactivefilter(char **);
#endif
-#ifdef MAXOCTETS
static int setmodir(char **);
-#endif
static int user_setenv(char **);
static void user_setprint(option_t *, printer_func, void *);
"Set pathname of ip-down script",
OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
{ "ipv6-up-script", o_string, path_ipv6up,
"Set pathname of ipv6-up script",
OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
#endif
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
{ "multilink", o_bool, &multilink,
"Enable multilink operation", OPT_PRIO | 1 },
{ "mp", o_bool, &multilink,
{ "bundle", o_string, &bundle_name,
"Bundle name for multilink", OPT_PRIO },
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
-#ifdef PLUGIN
+#ifdef PPP_WITH_PLUGINS
{ "plugin", o_special, (void *)loadplugin,
"Load a plug-in module into pppd", OPT_PRIV | OPT_A2LIST },
#endif
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
{ "pass-filter", o_special, setpassfilter,
"set filter for packets to pass", OPT_PRIO },
"set filter for active pkts", OPT_PRIO },
#endif
-#ifdef MAXOCTETS
{ "maxoctets", o_int, &maxoctets,
"Set connection traffic limit",
OPT_PRIO | OPT_LLIMIT | OPT_NOINCR | OPT_ZEROINF },
"Set direction for limit traffic (sum,in,out,max)" },
{ "mo-timeout", o_int, &maxoctets_timeout,
"Check for traffic limit every N seconds", OPT_PRIO | OPT_LLIMIT | 1 },
-#endif
/* Dummy option, does nothing */
{ "noipx", o_bool, &noipx_opt, NULL, OPT_NOPRINT | 1 },
return ok;
}
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
/*
* setpassfilter - Set the pass filter for packets
*/
return 1;
}
-#ifdef MAXOCTETS
static int
setmodir(char **argv)
{
}
return 1;
}
-#endif
-#ifdef PLUGIN
+#ifdef PPP_WITH_PLUGINS
static int
loadplugin(char **argv)
{
free(path);
return 0;
}
-#endif /* PLUGIN */
+#endif /* PPP_WITH_PLUGINS */
/*
* Set an environment variable specified by the user.
+++ /dev/null
-#define DATE "5 January 2021"
/*
* define path names
*/
+#ifndef PPP_PATHNAMES_H
+#define PPP_PATHNAMES_H
+
#include "pppdconf.h"
#ifdef HAVE_PATHS_H
#define _PATH_CHAPFILE _ROOT_PATH "/etc/ppp/chap-secrets"
#define _PATH_SRPFILE _ROOT_PATH "/etc/ppp/srp-secrets"
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
#define _PATH_EAPTLSCLIFILE _ROOT_PATH "/etc/ppp/eaptls-client"
#define _PATH_EAPTLSSERVFILE _ROOT_PATH "/etc/ppp/eaptls-server"
#define _PATH_OPENSSLCONFFILE _ROOT_PATH "/etc/ppp/openssl.cnf"
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
#define _PATH_SYSOPTIONS _ROOT_PATH "/etc/ppp/options"
#define _PATH_IPUP _ROOT_PATH "/etc/ppp/ip-up"
#define _PATH_USEROPT ".ppprc"
#define _PATH_PSEUDONYM ".ppp_pseudonym"
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
#define _PATH_IPV6UP _ROOT_PATH "/etc/ppp/ipv6-up"
#define _PATH_IPV6DOWN _ROOT_PATH "/etc/ppp/ipv6-down"
#endif
#define _PATH_PPPDB _PPP_VARRUN "pppd2.tdb"
#endif /* __STDC__ */
+#endif /* PPP_PATHNAMES_H */
#include <openssl/hmac.h>
#include <openssl/rand.h>
#include <openssl/err.h>
-#include <net/ppp_defs.h>
#include "pppd.h"
#include "eap.h"
u_char tk[PEAP_TLV_TK_LEN];
u_char nonce[PEAP_TLV_NONCE_LEN];
struct tls_info *info;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
struct chap_digest_type *chap;
#endif
};
BCOPY(nonce, (data_tlv + PEAP_TLV_HEADERLEN), PEAP_TLV_NONCE_LEN);
data_tlv[60] = EAPT_PEAP;
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
mppe_get_send_key(isk, MPPE_MAX_KEY_LEN);
mppe_get_recv_key(isk + MPPE_MAX_KEY_LEN, MPPE_MAX_KEY_LEN);
#endif
fatal("server's CMK does not match client's CMK, potential MiTM");
}
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
#define PEAP_MPPE_KEY_LEN 32
static void generate_mppe_keys(u_char *ipmk, int client)
outp = outp + PEAP_TLV_RESULT_LEN;
RAND_bytes(psm->nonce, PEAP_TLV_NONCE_LEN);
generate_cmk(psm->ipmk, psm->tk, psm->nonce, outp, 1);
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
/* set mppe keys */
generate_mppe_keys(psm->ipmk, 1);
#endif
used += 2;
break;
-#if CHAPMS
+#if PPP_WITH_CHAPMS
case EAPT_MSCHAPV2: {
// Must have at least 4 more bytes to process CHAP header
#ifndef PPP_PEAP_H
#define PPP_PEAP_H
+#include "pppdconf.h"
+
#define PEAP_PHASE_1 1
#define PEAP_PHASE_2 2
pppd_plugin_LTLIBRARIES = minconn.la passprompt.la passwordfd.la winbind.la
pppd_plugindir = $(PPPD_PLUGIN_DIR)
-PLUGIN_CPPFLAGS = -I${top_srcdir}/include -I${top_srcdir}/pppd
+PLUGIN_CPPFLAGS = -I${top_srcdir}
PLUGIN_LDFLAGS = -module -avoid-version
minconn_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
#include <stddef.h>
#include <time.h>
-#include "pppd.h"
+#include <pppd/pppd.h>
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
static int minconnect = 0;
* 2 of the License, or (at your option) any later version.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <errno.h>
#include <unistd.h>
#include <sys/wait.h>
+#include <sys/param.h>
+#include <limits.h>
#include <syslog.h>
-#include "pppd.h"
+#include <pppd/pppd.h>
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
static char promptprog[PATH_MAX+1];
static int promptprog_refused = 0;
{
add_options(options);
pap_passwd_hook = promptpass;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
eaptls_passwd_hook = promptpass;
#endif
}
* with pap- and chap-secrets files.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
-#include "pppd.h"
+#include <pppd/pppd.h>
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
static int passwdfd = -1;
static char save_passwd[MAXSECRETLEN];
chap_check_hook = pwfd_check;
chap_passwd_hook = pwfd_passwd;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
eaptls_passwd_hook = pwfd_passwd;
#endif
}
atmres.h \
atmsap.h
-pppoatm_la_CPPFLAGS = -I${top_srcdir}/include -I${top_srcdir}/pppd
+pppoatm_la_CPPFLAGS = -I${top_srcdir}
pppoatm_la_LDFLAGS = -module -avoid-version
pppoatm_la_SOURCES = pppoatm.c
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include "pppd.h"
-#include "pathnames.h"
-#include "fsm.h" /* Needed for lcp.h to include cleanly */
-#include "lcp.h"
#include <atm.h>
#include <linux/atmdev.h>
#include <linux/atmppp.h>
#include <sys/stat.h>
#include <net/if.h>
#include <sys/ioctl.h>
+#include <sys/param.h>
+
+#include <pppd/pppd.h>
+#include <pppd/pathnames.h>
+#include <pppd/fsm.h> /* Needed for lcp.h to include cleanly */
+#include <pppd/lcp.h>
+
-const char pppd_version[] = VERSION;
+const char pppd_version[] = PPPD_VERSION;
static struct sockaddr_atmpvc pvcaddr;
static char *qosstr = NULL;
return 1;
memcpy(&pvcaddr, &addr, sizeof pvcaddr);
- strlcpy(devnam, cp, sizeof devnam);
+ strlcpy(devnam, cp, MAXPATHLEN);
devstat.st_mode = S_IFSOCK;
if (the_channel != &pppoa_channel) {
the_channel = &pppoa_channel;
pppoatm_max_mtu = lcp_allowoptions[0].mru;
pppoatm_max_mru = lcp_wantoptions[0].mru;
set_line_discipline_pppoatm(fd);
- strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam));
+ strlcpy(ppp_devnam, devnam, MAXPATHLEN);
pppoa_fd = fd;
return fd;
}
noinst_HEADERS = \
pppoe.h
-pppoe_la_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/include
+pppoe_la_CPPFLAGS = -I${top_srcdir}
pppoe_la_LDFLAGS = -module -avoid-version
pppoe_la_SOURCES = plugin.c discovery.c if.c common.c
-pppoe_discovery_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/include
+pppoe_discovery_CPPFLAGS = -I${top_srcdir}
pppoe_discovery_SOURCES = pppoe-discovery.c discovery.c if.c common.c
"$Id: common.c,v 1.3 2008/06/09 08:34:23 paulus Exp $";
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#define _GNU_SOURCE 1
#include "pppoe.h"
-#include "pppd/pppd.h"
+#include <pppd/pppd.h>
#include <string.h>
#include <errno.h>
--- /dev/null
+/* pppd/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <asm/types.h> header file. */
+#undef HAVE_ASM_TYPES_H
+
+/* Define to 1 if you have the <linux/if_ether.h> header file. */
+#undef HAVE_LINUX_IF_ETHER_H
+
+/* Define to 1 if you have the <linux/if.h> header file. */
+#undef HAVE_LINUX_IF_H
+
+/* Define to 1 if you have the <linux/if_packet.h> header file. */
+#undef HAVE_LINUX_IF_PACKET_H
+
+/* Define to 1 if you have the <net/if_arp.h> header file. */
+#undef HAVE_NET_IF_ARP_H
+
+/* Define to 1 if you have the <net/if_types.h> header file. */
+#undef HAVE_NET_IF_TYPES_H
+
+/* Define to 1 if you have the <netinet/if_ether.h> header file. */
+#undef HAVE_NETINET_IF_ETHER_H
+
+/* Define to 1 if you have the <netpacket/packet.h> header file. */
+#undef HAVE_NETPACKET_PACKET_H
+
+/* Define to 1 if you have the <net/bpf.h> header file. */
+#undef HAVE_NET_BPF_H
+
+/* Define to 1 if you have the <net/if.h> header file. */
+#undef HAVE_NET_IF_H
+
+/* Define to 1 if you have the <sys/dlpi.h> header file. */
+#undef HAVE_SYS_DLPI_H
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#undef HAVE_SYS_UIO_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* The size of `unsigned int', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_INT
+
+/* The size of `unsigned long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG
+
+/* The size of `unsigned short', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_SHORT
+
"$Id: discovery.c,v 1.6 2008/06/15 04:35:50 paulus Exp $";
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#define _GNU_SOURCE 1
#include "pppoe.h"
-#include "pppd/pppd.h"
-#include "pppd/fsm.h"
-#include "pppd/lcp.h"
+#include <pppd/pppd.h>
+#include <pppd/fsm.h>
+#include <pppd/lcp.h>
#include <string.h>
#include <stdlib.h>
"$Id: if.c,v 1.2 2008/06/09 08:34:23 paulus Exp $";
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#define _GNU_SOURCE 1
#include "pppoe.h"
-#include "pppd/pppd.h"
+#include <pppd/pppd.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
"$Id: plugin.c,v 1.17 2008/06/15 04:35:50 paulus Exp $";
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#define _GNU_SOURCE 1
#include "pppoe.h"
-#include "pppd/pppd.h"
-#include "pppd/fsm.h"
-#include "pppd/lcp.h"
-#include "pppd/ipcp.h"
-#include "pppd/ccp.h"
-/* #include "pppd/pathnames.h" */
-
#include <linux/types.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/param.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <linux/ppp_defs.h>
#include <linux/if_pppox.h>
+#include <pppd/pppd.h>
+#include <pppd/fsm.h>
+#include <pppd/lcp.h>
+#include <pppd/ipcp.h>
+#include <pppd/ccp.h>
+/* #include <pppd/pathnames.h> ?, see below ... */
+
#ifndef _ROOT_PATH
#define _ROOT_PATH ""
#endif
#define _PATH_ETHOPT _ROOT_PATH "/etc/ppp/options."
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
/* From sys-linux.c in pppd -- MUST FIX THIS! */
extern int new_style_driver;
conn->acName = acName;
conn->serviceName = pppd_pppoe_service;
- strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam));
+ strlcpy(ppp_devnam, devnam, MAXPATHLEN);
if (existingSession) {
unsigned int mac[ETH_ALEN];
int i, ses;
/* Close socket */
close(fd);
if (r && doit) {
- strlcpy(devnam, cmd, sizeof(devnam));
+ strlcpy(devnam, cmd, MAXPATHLEN);
if (the_channel != &pppoe_channel) {
the_channel = &pppoe_channel;
add_options(Options);
- info("PPPoE plugin from pppd %s", VERSION);
+ info("PPPoE plugin from pppd %s", PPPD_VERSION);
}
void pppoe_check_options(void)
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <signal.h>
+#include <sys/time.h>
#include "pppoe.h"
optarg, strerror(errno));
exit(1);
}
- fprintf(debugFile, "pppoe-discovery from pppd %s\n", VERSION);
+ fprintf(debugFile, "pppoe-discovery from pppd %s\n", PPPD_VERSION);
break;
case 'I':
conn->ifName = xstrdup(optarg);
" -U -- Use Host-Unique to allow multiple PPPoE sessions.\n"
" -W hexvalue -- Set the Host-Unique to the supplied hex string.\n"
" -h -- Print usage information.\n");
- fprintf(stderr, "\npppoe-discovery from pppd " VERSION "\n");
+ fprintf(stderr, "\npppoe-discovery from pppd " PPPD_VERSION "\n");
}
#include <ctype.h>
#include <string.h>
-#include "pppd/pppd.h" /* For error */
+#include <pppd/pppd.h> /* For error */
/* How do we access raw Ethernet devices? */
#undef USE_LINUX_PACKET
noinst_HEADERS = \
l2tp_event.h
-pppol2tp_la_CPPFLAGS = -I${top_srcdir}/include -I${top_srcdir}/pppd
+pppol2tp_la_CPPFLAGS = -I${top_srcdir}
pppol2tp_la_LDFLAGS = -module -avoid-version
pppol2tp_la_SOURCES = pppol2tp.c
-openl2tp_la_CPPFLAGS = -I${top_srcdir}/include -I${top_srcdir}/pppd
+openl2tp_la_CPPFLAGS = -I${top_srcdir}
openl2tp_la_LDFLAGS = -module -avoid-version
openl2tp_la_SOURCES = openl2tp.c
/* pppd plugin for interfacing to openl2tpd */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
-#include "pppd.h"
-#include "pathnames.h"
-#include "fsm.h"
-#include "lcp.h"
-#include "ccp.h"
-#include "ipcp.h"
+
#include <sys/stat.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <linux/version.h>
#include <linux/sockios.h>
+#include <pppd/pppd.h>
+#include <pppd/pathnames.h>
+#include <pppd/fsm.h>
+#include <pppd/lcp.h>
+#include <pppd/ccp.h>
+#include <pppd/ipcp.h>
+
+
#ifndef aligned_u64
/* should be defined in sys/types.h */
#define aligned_u64 unsigned long long __attribute__((aligned(8)))
uint32_t send_accm, uint32_t recv_accm);
extern void (*pppol2tp_ip_updown_hook)(int tunnel_id, int session_id, int up);
-const char pppd_version[] = VERSION;
+const char pppd_version[] = PPPD_VERSION;
static int openl2tp_fd = -1;
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
-#include "pppd.h"
-#include "pathnames.h"
-#include "fsm.h"
-#include "lcp.h"
-#include "ccp.h"
-#include "ipcp.h"
#include <sys/stat.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <signal.h>
#include <linux/version.h>
#include <linux/sockios.h>
+
#ifndef aligned_u64
/* should be defined in sys/types.h */
#define aligned_u64 unsigned long long __attribute__((aligned(8)))
#endif
+
#include <linux/types.h>
#include <linux/if_ether.h>
#include <linux/ppp_defs.h>
#include <linux/if_pppox.h>
#include <linux/if_pppol2tp.h>
+#include <pppd/pppd.h>
+#include <pppd/pathnames.h>
+#include <pppd/fsm.h>
+#include <pppd/lcp.h>
+#include <pppd/ccp.h>
+#include <pppd/ipcp.h>
+
+
/* should be added to system's socket.h... */
#ifndef SOL_PPPOL2TP
#define SOL_PPPOL2TP 273
#endif
-const char pppd_version[] = VERSION;
+const char pppd_version[] = PPPD_VERSION;
static int setdevname_pppol2tp(char **argv);
etc/realms \
etc/servers
-RADIUS_CPPFLAGS = -I${top_srcdir}/include -I${top_srcdir}/pppd -DRC_LOG_FACILITY=LOG_DAEMON
+RADIUS_CPPFLAGS = -I${top_srcdir} -DRC_LOG_FACILITY=LOG_DAEMON
RADIUS_LDFLAGS = -module -avoid-version $(LDFLAGS)
radius_la_CPPFLAGS = $(RADIUS_CPPFLAGS)
#include <time.h>
-#include "magic.h"
+#include <pppd/magic.h>
/* rlib/lock.c */
int do_lock_exclusive(int);
/*
* $Id: md5.c,v 1.1 2004/11/14 07:26:26 paulus Exp $
*/
-#include "md5.h"
+#include <pppd/md5.h>
void rc_md5_calc (unsigned char *output, unsigned char *input, unsigned int inlen)
{
static char const RCSID[] =
"$Id: radattr.c,v 1.2 2004/10/28 00:24:40 paulus Exp $";
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pppd.h"
-#include "radiusclient.h"
#include <stdio.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <pppd/pppd.h>
+
+#include "radiusclient.h"
extern void (*radius_attributes_hook)(VALUE_PAIR *);
static void print_attributes(VALUE_PAIR *);
static void cleanup(void *opaque, int arg);
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
/**********************************************************************
* %FUNCTION: plugin_init
static char const RCSID[] =
"$Id: radius.c,v 1.32 2008/05/26 09:18:08 paulus Exp $";
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pppd.h"
-#include "chap-new.h"
-#ifdef CHAPMS
-#include "chap_ms.h"
-#ifdef MPPE
-#include "mppe.h"
-#include "md5.h"
-#endif
-#endif
-#include "radiusclient.h"
-#include "fsm.h"
-#include "ipcp.h"
#include <syslog.h>
#include <sys/types.h>
#include <sys/time.h>
+#include <sys/param.h>
#include <string.h>
#include <netinet/in.h>
#include <stdlib.h>
+#include <pppd/pppd.h>
+#include <pppd/chap-new.h>
+#ifdef PPP_WITH_CHAPMS
+#include <pppd/chap_ms.h>
+#ifdef PPP_WITH_MPPE
+#include <pppd/mppe.h>
+#include <pppd/md5.h>
+#endif
+#endif
+#include <pppd/fsm.h>
+#include <pppd/ipcp.h>
+
+#include "radiusclient.h"
+
#define BUF_LEN 1024
#define MD5_HASH_SIZE 16
static int get_client_port(char *ifname);
static int radius_allowed_address(u_int32_t addr);
static void radius_acct_interim(void *);
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
static int radius_setmppekeys(VALUE_PAIR *vp, REQUEST_INFO *req_info,
unsigned char *);
static int radius_setmppekeys2(VALUE_PAIR *vp, REQUEST_INFO *req_info);
static struct radius_state rstate;
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
/**********************************************************************
* %FUNCTION: plugin_init
int result;
int challenge_len, response_len;
u_char cpassword[MAX_RESPONSE_LEN + 1];
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
/* Need the RADIUS secret and Request Authenticator to decode MPPE */
REQUEST_INFO request_info, *req_info = &request_info;
#else
/* return error for types we can't handle */
if ((digest->code != CHAP_MD5)
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
&& (digest->code != CHAP_MICROSOFT)
&& (digest->code != CHAP_MICROSOFT_V2)
#endif
cpassword, MD5_HASH_SIZE + 1, VENDOR_NONE);
break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
case CHAP_MICROSOFT:
{
/* MS-CHAP-Challenge and MS-CHAP-Response */
{
u_int32_t remote;
int ms_chap2_success = 0;
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
int mppe_enc_keys = 0; /* whether or not these were received */
int mppe_enc_policy = 0;
int mppe_enc_types = 0;
/* idle parameter */
idle_time_limit = vp->lvalue;
break;
-#ifdef MAXOCTETS
case PW_SESSION_OCTETS_LIMIT:
/* Session traffic limit */
maxoctets = vp->lvalue;
/* Session traffic limit direction check */
maxoctets_dir = ( vp->lvalue > 4 ) ? 0 : vp->lvalue ;
break;
-#endif
case PW_ACCT_INTERIM_INTERVAL:
/* Send accounting updates every few seconds */
rstate.acct_interim_interval = vp->lvalue;
} else if (vp->vendorcode == VENDOR_MICROSOFT) {
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
switch (vp->attribute) {
case PW_MS_CHAP2_SUCCESS:
if ((vp->lvalue != 43) || strncmp((char*) vp->strvalue + 1, "S=", 2)) {
ms_chap2_success = 1;
break;
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
case PW_MS_CHAP_MPPE_KEYS:
if (radius_setmppekeys(vp, req_info, challenge) < 0) {
slprintf(msg, BUF_LEN,
mppe_enc_types = vp->lvalue; /* save for later */
break;
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
#ifdef MSDNS
case PW_MS_PRIMARY_DNS_SERVER:
ao->dnsaddr[0] = htonl(vp->lvalue);
break;
#endif /* MSDNS */
}
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
}
vp = vp->next;
}
if (digest && (digest->code == CHAP_MICROSOFT_V2) && !ms_chap2_success)
return -1;
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
/*
* Require both policy and key attributes to indicate a valid key.
* Note that if the policy value was '0' we don't set the key!
return 0;
}
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
/**********************************************************************
* %FUNCTION: radius_setmppekeys
* %ARGUMENTS:
return 0;
}
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
/**********************************************************************
* %FUNCTION: radius_acct_start
av_type = PW_ACCT_SESSION_TIMEOUT;
break;
-#ifdef MAXOCTETS
case EXIT_TRAFFIC_LIMIT:
av_type = PW_NAS_REQUEST;
break;
-#endif
default:
av_type = PW_NAS_ERROR;
#ifndef RADIUSCLIENT_H
#define RADIUSCLIENT_H
-#include <sys/types.h>
-#include <stdio.h>
-#include <time.h>
-#include "pppd.h"
+#include <sys/types.h>
+#include <stdio.h>
+#include <time.h>
+#include <pppd/pppd.h>
#ifndef _UINT4_T
/* This works for all machines that Linux runs on... */
static char const RCSID[] =
"$Id: radrealms.c,v 1.2 2004/11/14 07:26:26 paulus Exp $";
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pppd.h"
-#include "radiusclient.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/param.h>
+#include <pppd/pppd.h>
+
+#include "radiusclient.h"
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
char radrealms_config[MAXPATHLEN] = "/etc/radiusclient/realms";
*
***********************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "pppd.h"
-#include "chap-new.h"
-#include "chap_ms.h"
-#include "fsm.h"
-#include "ipcp.h"
-#include "mppe.h"
#include <syslog.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <ctype.h>
+#include <pppd/pppd.h>
+#include <pppd/chap-new.h>
+#include <pppd/chap_ms.h>
+#include <pppd/fsm.h>
+#include <pppd/ipcp.h>
+#include <pppd/mppe.h>
+
#define BUF_LEN 1024
#define NOT_AUTHENTICATED 0
char *message, int message_space);
static int winbind_allowed_address(u_int32_t addr);
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
/**********************************************************************
* %FUNCTION: plugin_init
nt_response = &response[MS_CHAP_NTRESP];
nt_response_size = MS_CHAP_NTRESP_LEN;
} else {
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
lm_response = &response[MS_CHAP_LANMANRESP];
lm_response_size = MS_CHAP_LANMANRESP_LEN;
#else
/* Should really propagate this into the error packet. */
notice("Peer request for LANMAN auth not supported");
return NOT_AUTHENTICATED;
-#endif /* MSLANMAN */
+#endif /* PPP_WITH_MSLANMAN */
}
/* ship off to winbind, and check */
nt_response, nt_response_size,
session_key,
&error_string) == AUTHENTICATED) {
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
mppe_set_chapv1(challenge, session_key);
#endif
slprintf(message, message_space, "Access granted");
&response[MS_CHAP2_NTRESP],
&response[MS_CHAP2_PEER_CHALLENGE],
challenge, user, saresponse);
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
mppe_set_chapv2(session_key, &response[MS_CHAP2_NTRESP],
MS_CHAP2_AUTHENTICATOR);
#endif
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "pppdconf.h"
+#ifndef PPP_PPPCRYPT_H
+#define PPP_PPPCRYPT_H
-#ifndef PPPCRYPT_H
-#define PPPCRYPT_H
+#include "pppdconf.h"
#ifdef HAVE_CRYPT_H
#include <crypt.h>
extern bool DesEncrypt(u_char *, u_char *);
extern bool DesDecrypt(u_char *, u_char *);
-#endif /* PPPCRYPT_H */
+#endif /* PPP_PPPCRYPT_H */
* $Id: pppd.h,v 1.96 2008/06/23 11:47:18 paulus Exp $
*/
-#include "pppdconf.h"
-
-/*
- * 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 <stdarg.h>
#include <stdint.h>
-#include <limits.h> /* for NGROUPS_MAX */
-#include <sys/param.h> /* for MAXPATHLEN and BSD4_4, if defined */
#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 <net/if.h>
-#include "patchlevel.h"
+#else
+#include <linux/ppp_defs.h>
+#endif
+
+#ifdef PPP_WITH_IPV6CP
+#if defined(SOL2)
+#include <netinet/in.h>
-#ifdef INET6
-#include "eui64.h"
+typedef union {
+ uint8_t e8[8]; /* lower 64-bit IPv6 address */
+ uint32_t e32[2]; /* lower 64-bit IPv6 address */
+} eui64_t;
+
+/*
+ * 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
/*
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 path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
-extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
-extern char req_ifname[IFNAMSIZ]; /* 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 dryrun; /* check everything, print options, exit */
extern int child_wait; /* # seconds to wait for children at end */
-#ifdef INET6
-extern char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */
-extern char path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-down script */
+#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(USE_EAPTLS) || defined(USE_PEAP)
-
+#if defined(PPP_WITH_EAPTLS) || defined(PPP_WITH_PEAP)
#define TLS_VERIFY_NONE "none"
#define TLS_VERIFY_NAME "name"
#define TLS_VERIFY_SUBJECT "subject"
extern char *max_tls_version;
extern bool tls_verify_key_usage;
extern char *tls_verify_method;
-#endif /* USE_EAPTLS || USE_PEAP */
+#endif /* PPP_WITH_EAPTLS || PPP_WITH_PEAP */
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
extern char *pkcs12_file;
-#endif /* USE_EAPTLS */
+#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)
#define PPP_OCTETS_DIRECTION_MAXOVERAL 3
/* same as previos, but little different on RADIUS side */
#define PPP_OCTETS_DIRECTION_MAXSESSION 4
-#endif
-#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
+#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);
/* 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
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 offsetof(type, member) ((size_t) &((type *)0)->member)
#endif
-#endif /* __PPP_H__ */
+#endif /* PPP_PPPD_H */
* in pppd when configured.
*/
-/* "Have Microsoft CHAP support" */
-#undef CHAPMS
+#ifndef PPP_PPPDCONF_H
+#define PPP_PPPDCONF_H
-/* "Have Microsoft MPPE support" */
-#undef MPPE
+/* Have Microsoft CHAP support */
+#undef PPP_WITH_CHAPMS
-/* "Have multilink support" */
-#undef HAVE_MULTILINK
+/* Have Microsoft LAN Manager support */
+#undef PPP_WITH_MSLANMAN
-/* "Have packet activity filter support" */
-#undef PPP_FILTER
+/* Have Microsoft MPPE support */
+#undef PPP_WITH_MPPE
-/* "Have support for loadable plugins" */
-#undef PLUGIN
+/* Have multilink support */
+#undef PPP_WITH_MULTILINK
-/* "Limit sessions by maximum number of octets" */
-#undef MAXOCTETS
+/* Have packet activity filter support */
+#undef PPP_WITH_FILTER
-/* Have Microsoft Callback Protocol support */
-#undef CBCP_SUPPORT
+/* Have support for loadable plugins */
+#undef PPP_WITH_PLUGINS
-/* "Include Trivial Database support" */
-#undef USE_TDB
+/* Have Callback Protocol support */
+#undef PPP_WITH_CBCP
-/* "Have IPv6 support" */
-#undef INET6
+/* Include TDB support */
+#undef PPP_WITH_TDB
-/* "Support for Pluggable Authentication Modules" */
-#undef USE_PAM
+/* Have IPv6 Control Protocol */
+#undef PPP_WITH_IPV6CP
-/* "Have EAP-SRP authentication support" */
-#undef USE_SRP
+/* Support for Pluggable Authentication Modules */
+#undef PPP_WITH_PAM
-/* "Have EAP-TLS authentication support" */
-#undef USE_EAPTLS
+/* Have EAP-SRP authentication support */
+#undef PPP_WITH_SRP
-/* "Have PEAP authentication support" */
-#undef USE_PEAP
+/* Have EAP-TLS authentication support */
+#undef PPP_WITH_EAPTLS
+
+/* Have PEAP authentication support */
+#undef PPP_WITH_PEAP
/* Use included des included with pppd */
#undef USE_CRYPT
/* Use included sha included with pppd */
#undef USE_SHA
-/* Version number of package */
-#undef VERSION
+/* The pppd version */
+#undef PPPD_VERSION
+
+#endif
#include "pppd.h"
#include "session.h"
-#ifdef USE_PAM
+#ifdef PPP_WITH_PAM
#include <security/pam_appl.h>
-#endif /* #ifdef USE_PAM */
+#endif /* #ifdef PPP_WITH_PAM */
#define SET_MSG(var, msg) if (var != NULL) { var[0] = msg; }
#define COPY_STRING(s) ((s) ? strdup(s) : NULL)
/* We have successfully started a session */
static bool logged_in = 0;
-#ifdef USE_PAM
+#ifdef PPP_WITH_PAM
/*
* Static variables used to communicate between the conversation function
* and the server_login function
&conversation,
NULL
};
-#endif /* #ifdef USE_PAM */
+#endif /* #ifdef PPP_WITH_PAM */
int
session_start(const int flags, const char *user, const char *passwd, const char *ttyName, char **msg)
{
-#ifdef USE_PAM
+#ifdef PPP_WITH_PAM
bool ok = 1;
const char *usr;
int pam_error;
bool try_session = 0;
-#else /* #ifdef USE_PAM */
+#else /* #ifdef PPP_WITH_PAM */
struct passwd *pw;
char *cbuf;
#ifdef HAVE_SHADOW_H
struct spwd *getspnam();
long now = 0;
#endif /* #ifdef HAVE_SHADOW_H */
-#endif /* #ifdef USE_PAM */
+#endif /* #ifdef PPP_WITH_PAM */
SET_MSG(msg, SUCCESS_MSG);
return SESSION_FAILED;
}
-#ifdef USE_PAM
+#ifdef PPP_WITH_PAM
/* Find the '\\' in the username */
/* This needs to be fixed to support different username schemes */
if ((usr = strchr(user, '\\')) == NULL)
/* If our PAM checks have already failed, then we must return a failure */
if (!ok) return SESSION_FAILED;
-#else /* #ifdef USE_PAM */
+#else /* #ifdef PPP_WITH_PAM */
/*
* Use the non-PAM methods directly. 'pw' will remain NULL if the user
return SESSION_FAILED;
}
-#endif /* #ifdef USE_PAM */
+#endif /* #ifdef PPP_WITH_PAM */
/*
* Write a wtmp entry for this user.
logwtmp(ttyName, user, ifname); /* Add wtmp login entry */
logged_in = 1;
-#if defined(_PATH_LASTLOG) && !defined(USE_PAM)
+#if defined(_PATH_LASTLOG) && !defined(PPP_WITH_PAM)
/*
* Enter the user in lastlog only if he has been authenticated using
* local system services. If he has not, then we don't know what his
(void)close(fd);
}
}
-#endif /* _PATH_LASTLOG and not USE_PAM */
+#endif /* _PATH_LASTLOG and not PPP_WITH_PAM */
info("user %s logged in on tty %s intf %s", user, ttyName, ifname);
}
void
session_end(const char* ttyName)
{
-#ifdef USE_PAM
+#ifdef PPP_WITH_PAM
int pam_error = PAM_SUCCESS;
if (pamh != NULL) {
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "pppdconf.h"
+#ifndef PPP_SESSION_H
+#define PPP_SESSION_H
-#ifndef __SESSION_H
-#define __SESSION_H
+#include "pppdconf.h"
#define SESS_AUTH 1 /* Check User Authentication */
#define SESS_ACCT 2 /* Check Account Validity */
void
session_end(const char* tty);
-#endif
+#endif // PPP_SESSION_H
#include <string.h>
#include <time.h>
#include <netinet/in.h> /* htonl() */
-#include <net/ppp_defs.h>
#include "sha1.h"
static void
/* sha1.h */
-#include "pppdconf.h"
+#ifndef PPP_SHA1_H
+#define PPP_SHA1_H
-#ifndef __SHA1_INCLUDE_
-#define __SHA1_INCLUDE_
+#include "pppdconf.h"
#ifndef USE_SHA
#include <openssl/sha.h>
extern void SHA1_Final(unsigned char[SHA1_SIGNATURE_SIZE], SHA1_CTX *);
#endif /* USE_SHA */
-#endif /* __SHA1_INCLUDE_ */
+#endif /* PPP_SHA1_H */
-#include "pppdconf.h"
+#ifndef PPP_SPINLOCK_H
+#define PPP_SPINLOCK_H
-#ifndef __SPINLOCK_H__
-#define __SPINLOCK_H__
+#include "pppdconf.h"
#include "tdb.h"
#endif
-#endif
+#endif // PPP_SPINLOCK_H
#include <sys/stat.h>
#include <sys/utsname.h>
#include <sys/sysmacros.h>
+#include <sys/param.h>
#include <errno.h>
#include <stddef.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <linux/ppp_defs.h>
-#include <linux/if_ppp.h>
+#include <linux/ppp-ioctl.h>
+
+#ifdef PPP_WITH_IPV6CP
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/if_link.h>
#define RTM_NEWSTATS 92
#define RTM_GETSTATS 94
#define IFLA_STATS_LINK_64 1
-#endif
+#endif /* PPP_WITH_IPV6CP */
-#ifdef INET6
#include <linux/if_addr.h>
/* glibc versions prior to 2.24 do not define SOL_NETLINK */
#ifndef SOL_NETLINK
#define SOL_NETLINK 270
#endif
+
/* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */
#ifndef NETLINK_CAP_ACK
#define NETLINK_CAP_ACK 10
#include "pppd.h"
#include "fsm.h"
#include "ipcp.h"
+#include "eui64.h"
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
#include <pcap-bpf.h>
#include <linux/filter.h>
-#endif /* PPP_FILTER */
+#endif /* PPP_WITH_FILTER */
#ifdef LOCKLIB
#include <sys/locks.h>
*/
#include "termios_linux.h"
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
#ifndef _LINUX_IN6_H
/*
* This is in linux/include/net/ipv6.h.
} while (0)
static const eui64_t nulleui64;
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
/* We can get an EIO error on an ioctl if the modem has hung up */
#define ok_error(num) ((num)==EIO)
static int sock_fd = -1; /* socket for doing interface ioctls */
static int slave_fd = -1; /* pty for old-style demand mode, slave */
static int master_fd = -1; /* pty for old-style demand mode, master */
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
static int sock6_fd = -1;
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
/*
* For the old-style kernel driver, this is the same as ppp_fd.
if (sock_fd < 0)
fatal("Couldn't create IP socket: %m(%d)", errno);
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
sock6_fd = socket(AF_INET6, SOCK_DGRAM, 0);
if (sock6_fd < 0)
sock6_fd = -errno; /* save errno for later */
if_is_up = 0;
sifdown(0);
}
+#ifdef PPP_WITH_IPV6CP
if (if6_is_up)
sif6down(0);
+#endif
/*
* Delete any routes through the device.
*/
if (have_default_route)
cifdefaultroute(0, 0, 0);
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
if (have_default_route6)
cif6defaultroute(0, nulleui64, nulleui64);
#endif
close(ppp_dev_fd);
if (sock_fd >= 0)
close(sock_fd);
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
if (sock6_fd >= 0)
close(sock6_fd);
#endif
modify_flags(ppp_dev_fd, SC_CCP_OPEN|SC_CCP_UP, x);
}
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
/*
* set_filters - set the active and pass filters in the kernel driver.
*/
}
return 1;
}
-#endif /* PPP_FILTER */
+#endif /* PPP_WITH_FILTER */
/********************************************************************
*
static u_int32_t iwraps = 0;
static u_int32_t owraps = 0;
- struct ifpppstatsreq req;
+ struct ifreq req;
+ struct ppp_stats data;
memset (&req, 0, sizeof (req));
- req.stats_ptr = (caddr_t) &req.stats;
- strlcpy(req.ifr__name, ifname, sizeof(req.ifr__name));
+ req.ifr_data = (caddr_t) &data;
+ strlcpy(req.ifr_name, ifname, sizeof(req.ifr_name));
if (ioctl(sock_fd, SIOCGPPPSTATS, &req) < 0) {
error("Couldn't get PPP statistics: %m");
return 0;
}
- stats->bytes_in = req.stats.p.ppp_ibytes;
- stats->bytes_out = req.stats.p.ppp_obytes;
- stats->pkts_in = req.stats.p.ppp_ipackets;
- stats->pkts_out = req.stats.p.ppp_opackets;
+ stats->bytes_in = data.p.ppp_ibytes;
+ stats->bytes_out = data.p.ppp_obytes;
+ stats->pkts_in = data.p.ppp_ipackets;
+ stats->pkts_out = data.p.ppp_opackets;
if (stats->bytes_in < previbytes)
++iwraps;
return 1;
}
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
/*
* /proc/net/ipv6_route parsing stuff.
*/
return 1;
}
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
/********************************************************************
*
if (if_is_up && --if_is_up > 0)
return 1;
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
if (if6_is_up)
return 1;
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
return setifstate(u, 0);
}
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
/********************************************************************
*
* sif6up - Config the interface up for IPv6
return setifstate(u, 0);
}
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
/********************************************************************
*
return 1;
}
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
/********************************************************************
*
* sif6addr_rtnetlink - Config the interface with both IPv6 link-local addresses via rtnetlink
}
return 1;
}
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
/*
* get_pty - get a pty master/slave pair and chown the slave side
#include <sys/ethernet.h>
#endif
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
#include <pcap.h>
#endif
#include "ipcp.h"
#include "ccp.h"
+#ifdef PPP_WITH_IPV6CP
+#include "eui64.h"
+#endif
+
#if !defined(PPP_DRV_NAME)
#define PPP_DRV_NAME "ppp"
#endif /* !defined(PPP_DRV_NAME) */
static int ipfd;
static int ipmuxid = -1;
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
static int ip6fd; /* IP file descriptor */
static int ip6muxid = -1; /* Multiplexer file descriptor */
static int if6_is_up = 0; /* IPv6 interface has been marked up */
#define IN6A_LLADDR_FROM_EUI64(s, eui64) \
_IN6A_LLX_FROM_EUI64(s, eui64, 0xfe800000)
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
-#if !defined(INET6) || !defined(SOL2)
+#if !defined(PPP_WITH_IPV6CP) || !defined(SOL2)
#define MAXIFS 256 /* Max # of interfaces */
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
static int restore_term;
static struct termios inittermios;
}
#endif /* SOL2 */
-#if defined(SOL2) && defined(INET6)
+#if defined(SOL2) && defined(PPP_WITH_IPV6CP)
/*
* get_first_ether_hwaddr - get the hardware address for the first
* ethernet-style interface on this system.
else
return -1;
}
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
#if defined(SOL2)
/*
}
#endif /* SOL2 */
-#if defined(SOL2) && defined(INET6)
+#if defined(SOL2) && defined(PPP_WITH_IPV6CP)
/*
* slifname - Sets interface ppa and flags
*
}
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
/*
* sys_init - System-dependent initialization.
{
int ifd, x;
struct ifreq ifr;
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
int i6fd;
struct lifreq lifr;
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
#if !defined(SOL2)
struct {
union DL_primitives prim;
if (ipfd < 0)
fatal("Couldn't open IP device: %m");
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
ip6fd = open(UDP6_DEV_NAME, O_RDWR, 0);
if (ip6fd < 0)
fatal("Couldn't open IP device (2): %m");
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
if (default_device && !notty)
tty_sid = getsid((pid_t)0);
strioctl(ifd, PPPIO_DEBUG, &x, sizeof(int), 0);
}
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
i6fd = open(PPP_DEV_NAME, O_RDWR, 0);
if (i6fd < 0) {
close(ifd);
x = PPPDBG_LOG + PPPDBG_DRIVER;
strioctl(i6fd, PPPIO_DEBUG, &x, sizeof(int), 0);
}
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
#if defined(SOL2)
if (ioctl(ifd, I_PUSH, IP_MOD_NAME) < 0) {
close(ifd);
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
close(i6fd);
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
fatal("Can't push IP module: %m");
}
*/
if (sifppa(ifd, ifunit) < 0) {
close (ifd);
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
close(i6fd);
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
fatal("Can't set ppa for unit %d: %m", ifunit);
}
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
/*
* An IPv6 interface is created anyway, even when the user does not
* explicitly enable it. Note that the interface will be marked
close(i6fd);
fatal("Can't set ifname for unit %d: %m", ifunit);
}
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
ipmuxid = ioctl(ipfd, I_PLINK, ifd);
close(ifd);
if (ipmuxid < 0) {
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
close(i6fd);
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
fatal("Can't I_PLINK PPP device to IP: %m");
}
*/
if (ioctl(ipfd, SIOCSIFMUXID, &ifr) < 0) {
ioctl(ipfd, I_PUNLINK, ipmuxid);
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
close(i6fd);
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
fatal("SIOCSIFMUXID: %m");
}
fatal("Can't link PPP device to IP: %m");
#endif /* defined(SOL2) */
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
ip6muxid = ioctl(ip6fd, I_PLINK, i6fd);
close(i6fd);
if (ip6muxid < 0) {
ioctl(ip6fd, I_PUNLINK, ip6muxid);
fatal("Can't link PPP device to IP (2): %m");
}
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
#if !defined(SOL2)
/* Set the interface name for the link. */
{
#if defined(SOL2)
struct ifreq ifr;
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
struct lifreq lifr;
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
#endif /* defined(SOL2) */
-#if defined(SOL2) && defined(INET6)
+#if defined(SOL2) && defined(PPP_WITH_IPV6CP)
if (if6_is_up)
sif6down(0);
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
if (if_is_up)
sifdown(0);
if (default_route_gateway)
error("Can't I_PUNLINK PPP from IP: %m");
return;
}
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
/*
* Make sure we ask ip what the muxid, because 'ifconfig modlist' will
* unlink and re-link the modules, causing the muxid to change.
if (ioctl(ip6fd, I_PUNLINK, ip6muxid) < 0) {
error("Can't I_PUNLINK PPP from IP (2): %m");
}
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
#endif /* defined(SOL2) */
}
sys_close(void)
{
close(ipfd);
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
close(ip6fd);
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
if (pppfd >= 0)
close(pppfd);
}
netif_set_mtu(int unit, int mtu)
{
struct ifreq ifr;
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
struct lifreq lifr;
int fd;
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
error("Couldn't set IP MTU (%s): %m", ifr.ifr_name);
}
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
fd = socket(AF_INET6, SOCK_DGRAM, 0);
if (fd < 0)
error("Couldn't open IPv6 socket: %m");
error("Couldn't set IPv6 MTU (%s): %m", ifr.ifr_name);
}
close(fd);
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
}
return 1;
}
-#if defined(SOL2) && defined(INET6)
+#if defined(SOL2) && defined(PPP_WITH_IPV6CP)
/*
* sif6up - Config the IPv6 interface up and enable IPv6 packets to pass.
*/
return 1;
}
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
#define INET_ADDR(x) (((struct sockaddr_in *) &(x))->sin_addr.s_addr)
-#include "pppdconf.h"
+#ifndef PPP_TDB_H
+#define PPP_TDB_H
-#ifndef __TDB_H__
-#define __TDB_H__
+#include "pppdconf.h"
/*
Unix SMB/CIFS implementation.
}
#endif
-#endif /* tdb.h */
+#endif /* PPP_TBD_H */
* Copyright (c) 2021 Marek BehĂșn <kabel@kernel.org>
*/
-#ifndef _TERMIOS_LINUX_H_
-#define _TERMIOS_LINUX_H_
+#ifndef PPP_TERMIOS_LINUX_H
+#define PPP_TERMIOS_LINUX_H
+
+#include "pppdconf.h"
/*
* We need to use raw TCGETS2/TCSETS2 or TCGETS/TCSETS ioctls with the BOTHER
t->c_cflag |= CS8;
}
-#endif /* _TERMIOS_LINUX_H_ */
+#endif /* PPP_TERMIOS_LINUX_H */
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef TLS_H
-#define TLS_H
+#ifndef PPP_TLS_H
+#define PPP_TLS_H
+
+#include "pppdconf.h"
/**
* Structure used in verifying the peer certificate
*/
void tls_log_sslerr( void );
-#endif /* TLS_H */
+#endif /* PPP_TLS_H */
}
if (doit) {
- strlcpy(devnam, cp, sizeof(devnam));
+ strlcpy(devnam, cp, MAXPATHLEN);
devstat = statbuf;
default_device = 0;
}
option_error("no device specified and stdin is not a tty");
exit(EXIT_OPTION_ERROR);
}
- strlcpy(devnam, p, sizeof(devnam));
+ strlcpy(devnam, p, MAXPATHLEN);
if (stat(devnam, &devstat) < 0)
fatal("Couldn't stat default device %s: %m", devnam);
}
* Get a pty master/slave pair if the pty, notty, socket,
* or record options were specified.
*/
- strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam));
+ strlcpy(ppp_devnam, devnam, MAXPATHLEN);
pty_master = -1;
pty_slave = -1;
real_ttyfd = -1;
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef PPP_UPAP_H
+#define PPP_UPAP_H
+
+#include "pppdconf.h"
/*
* Packet header = Code, id, length.
void upap_authpeer(int);
extern struct protent pap_protent;
+
+#endif // PPP_UPAP_H
dist_man8_MANS = pppdump.8
pppdump_SOURCES = pppdump.c bsd-comp.c deflate.c zlib.c
-pppdump_CFLAGS = -I${top_srcdir}/include/net
noinst_HEADERS = \
ppp-comp.h \
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-#include "ppp_defs.h"
+
#include "ppp-comp.h"
#if DO_BSD_COMPRESS
stats->comp_packets = db->comp_count;
stats->inc_bytes = db->incomp_bytes;
stats->inc_packets = db->incomp_count;
- stats->ratio = db->in_count;
+
+ u_int ratio = db->in_count;
out = db->bytes_out;
- if (stats->ratio <= 0x7fffff)
- stats->ratio <<= 8;
+ if (ratio <= 0x7fffff)
+ ratio <<= 8;
else
out >>= 8;
if (out != 0)
- stats->ratio /= out;
+ stats->ratio = ratio / out;
}
/*
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-#include "ppp_defs.h"
+
#include "ppp-comp.h"
#include "zlib.h"
*stats = state->stats;
stats->ratio = stats->unc_bytes;
out = stats->comp_bytes + stats->unc_bytes;
- if (stats->ratio <= 0x7ffffff)
- stats->ratio <<= 8;
+ u_int ratio = stats->ratio;
+ if (ratio <= 0x7ffffff)
+ ratio <<= 8;
else
out >>= 8;
if (out != 0)
- stats->ratio /= out;
+ stats->ratio = ratio / out;
}
/*
#define DO_PREDICTOR_1 0
#define DO_PREDICTOR_2 0
+#if defined(SOL2)
+#include <net/ppp_defs.h>
+#else
+#include <linux/ppp_defs.h>
+#endif
+
/*
* Structure giving methods for compression/decompression.
*/
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
-#include "ppp_defs.h"
+
#include "ppp-comp.h"
int hexmode;
0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
};
+#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
struct pkt {
int cnt;
pppstats_CFLAGS =
pppstats_CPPFLAGS =
-if LINUX
-pppstats_CFLAGS += -I${top_srcdir}/include
-endif
-
if SUNOS
pppstats_CPPFLAGS += -DSTREAMS
endif
#ifndef __linux__
#include <net/if.h>
#include <net/ppp_defs.h>
-#include <net/if_ppp.h>
#else
/* Linux */
#if __GLIBC__ >= 2
#endif
#include <linux/ppp_defs.h>
#include <linux/if_ppp.h>
+
#endif /* __linux__ */
#else /* STREAMS */
static void
get_ppp_stats(struct ppp_stats *curp)
{
- struct ifpppstatsreq req;
+ struct ifreq req;
memset (&req, 0, sizeof (req));
-#ifdef __linux__
- req.stats_ptr = (caddr_t) &req.stats;
-#undef ifr_name
-#define ifr_name ifr__name
-#endif
+ req.ifr_data = (caddr_t) curp;
strncpy(req.ifr_name, interface, IFNAMSIZ);
req.ifr_name[IFNAMSIZ - 1] = 0;
perror("couldn't get PPP statistics");
exit(1);
}
- *curp = req.stats;
}
static void
get_ppp_cstats(struct ppp_comp_stats *csp)
{
- struct ifpppcstatsreq creq;
+ struct ifreq req;
+ struct ppp_comp_stats stats;
- memset (&creq, 0, sizeof (creq));
+ memset (&req, 0, sizeof (req));
-#ifdef __linux__
- creq.stats_ptr = (caddr_t) &creq.stats;
-#undef ifr_name
-#define ifr_name ifr__name
-#endif
+ req.ifr_data = (caddr_t) &stats;
- strncpy(creq.ifr_name, interface, IFNAMSIZ);
- creq.ifr_name[IFNAMSIZ - 1] = 0;
- if (ioctl(s, SIOCGPPPCSTATS, &creq) < 0) {
+ strncpy(req.ifr_name, interface, IFNAMSIZ);
+ req.ifr_name[IFNAMSIZ - 1] = 0;
+ if (ioctl(s, SIOCGPPPCSTATS, &req) < 0) {
fprintf(stderr, "%s: ", progname);
if (errno == ENOTTY) {
fprintf(stderr, "no kernel compression support\n");
}
#ifdef __linux__
- if (creq.stats.c.bytes_out == 0) {
- creq.stats.c.bytes_out = creq.stats.c.comp_bytes + creq.stats.c.inc_bytes;
- creq.stats.c.in_count = creq.stats.c.unc_bytes;
+ if (stats.c.bytes_out == 0) {
+ stats.c.bytes_out = stats.c.comp_bytes + stats.c.inc_bytes;
+ stats.c.in_count = stats.c.unc_bytes;
}
- if (creq.stats.c.bytes_out == 0)
- creq.stats.c.ratio = 0.0;
+ if (stats.c.bytes_out == 0)
+ stats.c.ratio = 0.0;
else
- creq.stats.c.ratio = 256.0 * creq.stats.c.in_count /
- creq.stats.c.bytes_out;
+ stats.c.ratio = 256.0 * stats.c.in_count / stats.c.bytes_out;
- if (creq.stats.d.bytes_out == 0) {
- creq.stats.d.bytes_out = creq.stats.d.comp_bytes + creq.stats.d.inc_bytes;
- creq.stats.d.in_count = creq.stats.d.unc_bytes;
+ if (stats.d.bytes_out == 0) {
+ stats.d.bytes_out = stats.d.comp_bytes + stats.d.inc_bytes;
+ stats.d.in_count = stats.d.unc_bytes;
}
- if (creq.stats.d.bytes_out == 0)
- creq.stats.d.ratio = 0.0;
+ if (stats.d.bytes_out == 0)
+ stats.d.ratio = 0.0;
else
- creq.stats.d.ratio = 256.0 * creq.stats.d.in_count /
- creq.stats.d.bytes_out;
+ stats.d.ratio = 256.0 * stats.d.in_count / stats.d.bytes_out;
#endif
- *csp = creq.stats;
+ *csp = stats;
}
#else /* STREAMS */