]> git.ozlabs.org Git - ppp.git/commitdiff
Merge pull request #354 from pali/register-with-name
authorPaul Mackerras <paulus@ozlabs.org>
Fri, 5 Aug 2022 04:10:40 +0000 (14:10 +1000)
committerPaul Mackerras <paulus@ozlabs.org>
Fri, 5 Aug 2022 04:10:40 +0000 (14:10 +1000)
pppd: Add support for registering ppp interface via Linux rtnetlink API

87 files changed:
.gitignore
Makefile.am
configure.ac
include/net/if_ppp.h
m4/ax_check_atm.m4
m4/ax_check_pam.m4
m4/ax_check_pcap.m4
m4/ax_check_srp.m4
pppd/Makefile.am
pppd/auth.c
pppd/ccp.c
pppd/ccp.h
pppd/chap-md5.h
pppd/chap-new.c
pppd/chap-new.h
pppd/chap_ms.c
pppd/chap_ms.h
pppd/demand.c
pppd/eap-tls.c
pppd/eap-tls.h
pppd/eap.c
pppd/eap.h
pppd/ecp.h
pppd/eui64.h
pppd/fsm.h
pppd/ipcp.h
pppd/ipv6cp.c
pppd/ipv6cp.h
pppd/lcp.c
pppd/lcp.h
pppd/magic.h
pppd/main.c
pppd/md4.h
pppd/md5.h
pppd/mppe.h
pppd/options.c
pppd/patchlevel.h [deleted file]
pppd/pathnames.h
pppd/peap.c
pppd/peap.h
pppd/plugins/Makefile.am
pppd/plugins/minconn.c
pppd/plugins/passprompt.c
pppd/plugins/passwordfd.c
pppd/plugins/pppoatm/Makefile.am
pppd/plugins/pppoatm/pppoatm.c
pppd/plugins/pppoe/Makefile.am
pppd/plugins/pppoe/common.c
pppd/plugins/pppoe/config.h.in [new file with mode: 0644]
pppd/plugins/pppoe/discovery.c
pppd/plugins/pppoe/if.c
pppd/plugins/pppoe/plugin.c
pppd/plugins/pppoe/pppoe-discovery.c
pppd/plugins/pppoe/pppoe.h
pppd/plugins/pppol2tp/Makefile.am
pppd/plugins/pppol2tp/openl2tp.c
pppd/plugins/pppol2tp/pppol2tp.c
pppd/plugins/radius/Makefile.am
pppd/plugins/radius/includes.h
pppd/plugins/radius/md5.c
pppd/plugins/radius/radattr.c
pppd/plugins/radius/radius.c
pppd/plugins/radius/radiusclient.h
pppd/plugins/radius/radrealms.c
pppd/plugins/winbind.c
pppd/pppcrypt.h
pppd/pppd.h
pppd/pppdconf.h.in
pppd/session.c
pppd/session.h
pppd/sha1.c
pppd/sha1.h
pppd/spinlock.h
pppd/sys-linux.c
pppd/sys-solaris.c
pppd/tdb.h
pppd/termios_linux.h
pppd/tls.h
pppd/tty.c
pppd/upap.h
pppdump/Makefile.am
pppdump/bsd-comp.c
pppdump/deflate.c
pppdump/ppp-comp.h
pppdump/pppdump.c
pppstats/Makefile.am
pppstats/pppstats.c

index 133a3dfea3cdf9a61e0302896bb27c78c10628e4..c80a008c9ea7916e2a7d29a89745a56eb4ac4417 100644 (file)
@@ -35,6 +35,8 @@ autom4te.cache
 /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
index 15b2d098f060393b45f1f1bfbeffe6442ed0ce51..d7b376cd45b6e57d132b4a0572cd5bbfcaf6ea1a 100644 (file)
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS="-Im4"
 
 SUBDIRS = chat contrib pppd pppstats pppdump
 
-if WITH_PLUGINS
+if PPP_WITH_PLUGINS
 SUBDIRS += pppd/plugins
 endif
 
index dd22dc65ee3d66aef39220097c6d90cfb160fa91..5a134fa4cf59f29e4a80edf6cc874982313def7f 100644 (file)
@@ -11,7 +11,7 @@ AM_MAINTAINER_MODE([enable])
 
 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
@@ -38,8 +38,8 @@ case "${host_os}" in
        ;;
 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")
 
@@ -88,7 +88,7 @@ AC_CHECK_FUNCS([    \
 # 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"])
     ])
 ])
@@ -105,96 +105,91 @@ AC_ARG_ENABLE([systemd],
 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
@@ -226,7 +221,7 @@ AC_SUBST(PPPD_LOGFILE_DIR)
 #
 # 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
@@ -242,23 +237,23 @@ AS_IF([test "x${with_openssl}" != "xno" ], [
 
 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])]
@@ -267,7 +262,8 @@ AS_IF([test "${ac_cv_openssl_des}" = "no" ], [
 
 #
 # With libsrp support
-AX_CHECK_SRP
+AX_CHECK_SRP([
+    AC_DEFINE([PPP_WITH_SRP], 1, [Support for libsrp authentication module])])
 
 #
 # With libatm support
@@ -275,8 +271,8 @@ AX_CHECK_ATM
 
 #
 # 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
@@ -284,9 +280,9 @@ AX_CHECK_PCAP
 
 #
 # 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"
@@ -302,6 +298,7 @@ if test "x${with_gtk}" = "xyes"; then
 fi
 AM_CONDITIONAL([WITH_GTK], test "x${with_gtk}" = "xyes")
 
+AC_DEFINE_UNQUOTED(PPPD_VERSION, "$VERSION", [Version of pppd])
 
 AC_CONFIG_FILES([
     Makefile
@@ -410,6 +407,8 @@ Features enabled
     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}
 "
index d08605e3cbd9d34e8c5ff1a0403202d4e3d4b9f9..1beb4707663c55a5623ac30575d5f4bcc9a79764 100644 (file)
@@ -129,10 +129,10 @@ struct ifpppcstatsreq {
 #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 */
index 004fe9f351a046ff92f6b864ff74005aa27c530c..ddd0f5376ee7dcd93fcc3f36bf782d2c49d3e1b0 100644 (file)
@@ -77,7 +77,7 @@ AC_DEFUN([AX_CHECK_ATM], [
                 $1
             ], [
                 AC_MSG_RESULT([no])
-                with_atm=""
+                with_atm="no"
                 $2
             ])
         CPPFLAGS="$save_CPPFLAGS"
@@ -88,6 +88,6 @@ AC_DEFUN([AX_CHECK_ATM], [
         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")
 ])
 
index edb30e348c31966d1e36e2cb2f1ea7508c176c6a..b17a7573c8741f3a379df93bc6bca501535985c3 100644 (file)
@@ -77,7 +77,7 @@ AC_DEFUN([AX_CHECK_PAM], [
                 $1
             ], [
                 AC_MSG_RESULT([no])
-                with_pam=""
+                with_pam="no"
                 $2
             ])
         CPPFLAGS="$save_CPPFLAGS"
@@ -88,6 +88,6 @@ AC_DEFUN([AX_CHECK_PAM], [
         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")
 ])
 
index 6d70ec128d2ec32aa64bb9abd8ce204592dfb343..379a1137f4e6d4064c899e1e805cfb4716a05b44 100644 (file)
@@ -76,7 +76,7 @@ AC_DEFUN([AX_CHECK_PCAP], [
                 $1
             ], [
                 AC_MSG_RESULT([no])
-                with_pcap=""
+                with_pcap="no"
                 $2
             ])
         CPPFLAGS="$save_CPPFLAGS"
@@ -88,6 +88,6 @@ AC_DEFUN([AX_CHECK_PCAP], [
         AC_SUBST([PCAP_LDFLAGS])
     fi
 
-    AM_CONDITIONAL(WITH_PCAP, test -n "${with_pcap}")
+    AM_CONDITIONAL(WITH_PCAP, test "x${with_pcap}" != "xno")
 ])
 
index 631341d4ec6725fabd12a191479ea0f8f4ec8655..11e66f50936dca5fe66d127eeee70e21bc178860 100644 (file)
@@ -77,7 +77,7 @@ AC_DEFUN([AX_CHECK_SRP], [
                 $1
             ], [
                 AC_MSG_RESULT([no])
-                with_srp=""
+                with_srp="no"
                 $2
             ])
         CPPFLAGS="$save_CPPFLAGS"
@@ -89,6 +89,6 @@ AC_DEFUN([AX_CHECK_SRP], [
         AC_SUBST([SRP_LDFLAGS])
     fi
 
-    AM_CONDITIONAL(WITH_SRP, test -n "${with_srp}")
+    AM_CONDITIONAL(WITH_SRP, test "x${with_srp}" != "xno")
 ])
 
index 97edd3ce8f7f346bb39d051ba30867b6d4b12bf4..7dc6cdd33e5456b070974896163b6185265c6136 100644 (file)
@@ -7,7 +7,7 @@ utest_chap_CPPFLAGS = -DUNIT_TEST
 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
@@ -37,7 +37,6 @@ pppd_include_HEADERS = \
     md4.h \
     md5.h \
     mppe.h \
-    patchlevel.h \
     pathnames.h \
     peap.h \
     pppcrypt.h \
@@ -69,7 +68,7 @@ pppd_SOURCES = \
     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 =
 
@@ -80,10 +79,11 @@ endif
 
 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
@@ -93,21 +93,21 @@ pppd_SOURCES += pppcrypt.c
 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
@@ -115,31 +115,33 @@ pppd_LDFLAGS += -Wl,-E
 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
@@ -169,7 +171,8 @@ utest_chap_LDADD = libppp_crypt.la
 pppd_LIBS += libppp_crypt.la
 
 if WITH_SYSTEMD
-pppd_LIBS += -lsystemd
+pppd_CPPFLAGS += $(SYSTEMD_CFLAGS)
+pppd_LIBS += $(SYSTEMD_LIBS)
 endif
 
 if WITH_SRP
index fa32fea781362687c767442501afbdd7a6706c8c..fc2839009c35d0c76836d15f3ece65208b4bf9c9 100644 (file)
 #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"
@@ -198,7 +198,7 @@ int (*chap_check_hook)(void) = NULL;
 /* 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
@@ -210,7 +210,7 @@ int (*null_auth_hook)(struct wordlist **paddrs,
 
 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
@@ -244,7 +244,7 @@ bool cryptpap = 0;          /* Passwords in pap-secrets are encrypted */
 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
@@ -259,7 +259,7 @@ bool explicit_user = 0;             /* Set if "user" option supplied */
 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 */
@@ -269,7 +269,7 @@ char *tls_verify_method = NULL; /* Verify certificate method */
 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) */
@@ -290,7 +290,7 @@ static int  have_chap_secret (char *, char *, int, int *);
 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);
@@ -317,10 +317,7 @@ static int  set_noauth_addr (char **);
 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.
@@ -345,7 +342,7 @@ option_t auth_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,
@@ -376,7 +373,7 @@ option_t auth_options[] = {
       "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,
@@ -449,7 +446,7 @@ option_t auth_options[] = {
       "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" },
@@ -462,13 +459,13 @@ option_t auth_options[] = {
       "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 }
 };
 
@@ -793,7 +790,7 @@ link_established(int unit)
     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;
@@ -830,7 +827,7 @@ link_established(int unit)
        }
     }
 
-#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");
@@ -906,7 +903,7 @@ network_phase(int unit)
        }
     }
 
-#ifdef CBCP_SUPPORT
+#ifdef PPP_WITH_CBCP
     /*
      * If we negotiated callback, do it now.
      */
@@ -937,7 +934,7 @@ start_networks(int unit)
 
     new_phase(PHASE_NETWORK);
 
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
     if (multilink) {
        if (mp_join_bundle()) {
            if (multilink_join_hook)
@@ -947,9 +944,9 @@ start_networks(int unit)
            return;
        }
     }
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
 
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
     if (!demand)
        set_filters(&pass_filter, &active_filter);
 #endif
@@ -1019,7 +1016,7 @@ auth_peer_success(int unit, int protocol, int prot_flavor,
        case CHAP_MD5:
            bit |= CHAP_MD5_PEER;
            break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
        case CHAP_MICROSOFT:
            bit |= CHAP_MS_PEER;
            break;
@@ -1095,7 +1092,7 @@ auth_withpeer_success(int unit, int protocol, int prot_flavor)
        case CHAP_MD5:
            bit |= CHAP_MD5_WITHPEER;
            break;
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
        case CHAP_MICROSOFT:
            bit |= CHAP_MS_WITHPEER;
            break;
@@ -1164,10 +1161,8 @@ np_up(int unit, int proto)
        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.
@@ -1194,9 +1189,7 @@ np_down(int unit, int proto)
     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);
     }
 }
@@ -1213,7 +1206,6 @@ np_finished(int unit, int proto)
     }
 }
 
-#ifdef MAXOCTETS
 static void
 check_maxoctets(void *arg)
 {
@@ -1246,7 +1238,6 @@ check_maxoctets(void *arg)
         TIMEOUT(check_maxoctets, NULL, maxoctets_timeout);
     }
 }
-#endif
 
 /*
  * check_idle - check whether the link has been idle for long
@@ -1352,7 +1343,7 @@ auth_check_options(void)
                                    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 :
@@ -1415,7 +1406,7 @@ auth_reset(int unit)
        (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
        );
@@ -1434,7 +1425,7 @@ auth_reset(int unit)
                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
@@ -2414,7 +2405,7 @@ auth_script(char *script)
 }
 
 
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
 static int
 have_eaptls_secret_server(char *client, char *server,
                          int need_ip, int *lacks_ipp)
index 644a9d1128ad65691fb72f748d0b3a916f546bd6..088a163c3f68370623b09ee3ecf61ea6436ca419 100644 (file)
 
 #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"
@@ -67,7 +71,7 @@ static char deflate_value[8];
 /*
  * Option variables.
  */
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
 bool refuse_mppe_stateful = 1;         /* Allow stateful mode? */
 #endif
 
@@ -110,7 +114,7 @@ static option_t ccp_option_list[] = {
       "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",
@@ -445,7 +449,7 @@ ccp_input(int unit, u_char *p, int len)
     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");
@@ -500,7 +504,7 @@ ccp_protrej(int unit)
     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");
@@ -521,11 +525,11 @@ ccp_resetci(fsm *f)
     *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;
@@ -556,7 +560,7 @@ ccp_resetci(fsm *f)
            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
@@ -610,13 +614,11 @@ ccp_resetci(fsm *f)
        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;
@@ -627,7 +629,7 @@ ccp_resetci(fsm *f)
            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;
@@ -700,7 +702,7 @@ static void
      * 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];
 
@@ -810,7 +812,7 @@ static int
     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];
 
@@ -900,7 +902,7 @@ static int
     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;
@@ -922,7 +924,7 @@ static int
            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) {
@@ -991,7 +993,7 @@ ccp_rejci(fsm *f, u_char *p, int len)
     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");
@@ -1063,7 +1065,7 @@ ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak)
     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
@@ -1087,7 +1089,7 @@ ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak)
            clen = p[1];
 
            switch (type) {
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
            case CI_MPPE:
                if (!ao->mppe || clen != CILEN_MPPE) {
                    newret = CONFREJ;
@@ -1187,7 +1189,7 @@ ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak)
                 */
                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
@@ -1329,7 +1331,7 @@ ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak)
        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");
@@ -1349,7 +1351,7 @@ method_name(ccp_options *opt, ccp_options *opt2)
     if (!ANY_COMPRESS(*opt))
        return "(none)";
     switch (opt->method) {
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
     case CI_MPPE:
     {
        char *p = result;
@@ -1426,7 +1428,7 @@ ccp_up(fsm *f)
            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 */
@@ -1444,7 +1446,7 @@ ccp_down(fsm *f)
        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) {
@@ -1507,7 +1509,7 @@ ccp_printpkt(u_char *p, int plen,
            len -= optlen;
            optend = p + optlen;
            switch (code) {
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
            case CI_MPPE:
                if (optlen >= CILEN_MPPE) {
                    u_char mppe_opts;
@@ -1609,7 +1611,7 @@ ccp_datainput(int unit, u_char *pkt, int len)
             */
            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.
             */
index 35961b9b75a46ea0eee7625d6958b24c7e52a11d..a37695c18373f23a2d11eef36e7e8e0cda06288b 100644 (file)
@@ -29,6 +29,9 @@
  *
  * $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 {
@@ -51,3 +54,5 @@ extern ccp_options ccp_allowoptions[];
 extern ccp_options ccp_hisoptions[];
 
 extern struct protent ccp_protent;
+
+#endif
index 4dbbfd1ed590b6dac3dfbfa1645a95c7e7799fc2..55f9ba25f63c055802bb87d8fc7bc68c969eed5c 100644 (file)
  * 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
index ab4302b96a207313d81a1cfaf24897d19d63743a..565713f2cfa7bf2ed060c1211260673a46a29e60 100644 (file)
@@ -41,7 +41,7 @@
 #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
@@ -155,7 +155,7 @@ chap_init(int unit)
        memset(&server, 0, sizeof(server));
 
        chap_md5_init();
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
        chapms_init();
 #endif
 }
index b4b0ee23eb6d5bf6121e842d236a1e2214a745bb..9ebec54f82f4991458c16da8342500ed3b9df51d 100644 (file)
@@ -28,6 +28,9 @@
  * 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"
 
 /*
@@ -133,3 +136,5 @@ extern void chap_auth_with_peer(int unit, char *our_name, int digest_code);
 
 /* Represents the CHAP protocol to the main pppd code */
 extern struct protent chap_protent;
+
+#endif
index c6e4b34bd60001ab30b05189726f3550c95a5fcb..8e59280cbee6aab7b284b13a5222fa2b322a2f8e 100644 (file)
@@ -80,8 +80,6 @@
 #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[]);
@@ -112,16 +115,16 @@ static void       ChapMS2_NT (u_char *, u_char[16], char *, char *, int,
 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 */
@@ -132,14 +135,13 @@ static char *mschap2_peer_challenge = NULL;
 
 #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
@@ -197,7 +199,7 @@ chapms_verify_response(int id, char *name,
        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");
@@ -208,7 +210,7 @@ chapms_verify_response(int id, char *name,
        /* 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],
@@ -626,7 +628,7 @@ ChapMS2_NT(u_char *rchallenge, u_char PeerChallenge[16], char *username,
     ChallengeResponse(Challenge, PasswordHash, NTResponse);
 }
 
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
 static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */
 
 static void
@@ -718,7 +720,7 @@ GenerateAuthenticatorResponsePlain
 }
 
 
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
 
 /*
  * Set mppe_xxxx_key from MS-CHAP credentials. (see RFC 3079)
@@ -754,7 +756,7 @@ SetMasterKeys(char *secret, int secret_len, u_char NTResponse[24], int IsServer)
     mppe_set_chapv2(PasswordHashHash, NTResponse, IsServer);
 }
 
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
 
 
 void
@@ -765,7 +767,7 @@ ChapMS(u_char *rchallenge, char *secret, int secret_len,
 
     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]);
 
@@ -775,7 +777,7 @@ ChapMS(u_char *rchallenge, char *secret, int secret_len,
     response[MS_CHAP_USENT] = 1;
 #endif
 
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
     Set_Start_Key(rchallenge, secret, secret_len);
 #endif
 }
@@ -820,7 +822,7 @@ ChapMS2(u_char *rchallenge, u_char *PeerChallenge,
                                       &response[MS_CHAP2_PEER_CHALLENGE],
                                       rchallenge, user, authResponse);
 
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
     SetMasterKeys(secret, secret_len,
                  &response[MS_CHAP2_NTRESP], authenticator);
 #endif
@@ -944,5 +946,3 @@ int main(int argc, char *argv[]) {
 
 #endif  /* UNIT_TEST */
 
-
-#endif /* CHAPMS */
index c1c5ed846f5f5004f086de610a32ede41dc5a121..7b08cfff312317cfec7b353b811ec05c37358950 100644 (file)
  * $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 */
@@ -87,5 +88,4 @@ void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
 
 void chapms_init(void);
 
-#define __CHAPMS_INCLUDE__
-#endif /* __CHAPMS_INCLUDE__ */
+#endif /* PPP_CHAPMS_H */
index 0943e8a381ad5ce8ee2b12b3438708357f0c63d1..d610d69ac282ea83d9ca841bdea21b7c6663906a 100644 (file)
@@ -47,7 +47,7 @@
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
 #include <pcap-bpf.h>
 #endif
 
@@ -102,7 +102,7 @@ demand_conf(void)
        || 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
 
@@ -210,6 +210,7 @@ static u_short fcstab[256] = {
        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.
@@ -336,7 +337,7 @@ active_packet(unsigned char *p, int len)
     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)
index 40796d5887b0dac4427402b920876a8e78517b4c..69e34a1d7cc9023f37f9b0f18474b89bd80df438 100644 (file)
@@ -85,7 +85,7 @@ void ssl_msg_callback(int write_p, int version, int ct, const void *buf,
               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
 
 /*
@@ -137,7 +137,7 @@ void eaptls_gen_mppe_keys(struct eaptls_session *ets, int client)
     }
 }
 
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
 
 int password_callback (char *buf, int size, int rwflag, void *u)
 {
index 9c56687858aeece748575f2a96648483debb2ddd..2777d81f5c9b399fc02536bbf2de11e60552a079 100644 (file)
  *
  */
 
-#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>
@@ -88,7 +87,7 @@ int get_eaptls_secret(int unit, char *client, char *server,
               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
 
index 6cb595f5b7c57b78cdd22ed790928535f4f29777..4ad67a5c5eb70810ccbfb632819eb98907394d21 100644 (file)
 #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
 
@@ -115,7 +115,7 @@ static option_t eap_option_list[] = {
       "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,
@@ -157,7 +157,7 @@ struct protent eap_protent = {
        NULL                    /* say whether to bring up link for this pkt */
 };
 
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
 /*
  * A well-known 2048 bit modulus.
  */
@@ -195,7 +195,7 @@ static const u_char wkmodulus[] = {
        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);
@@ -227,10 +227,10 @@ eap_init(int unit)
        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
@@ -327,7 +327,7 @@ eap_send_success(eap_state *esp)
            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.
@@ -423,7 +423,7 @@ b64dec(struct b64state *bs, u_char *inp, int inlen, u_char *outp)
        }
        return (outlen);
 }
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
 
 /*
  * Assume that current waiting server state is complete and figure
@@ -434,7 +434,7 @@ b64dec(struct b64state *bs, u_char *inp, int inlen, u_char *outp)
 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;
@@ -443,23 +443,23 @@ eap_figure_next_state(eap_state *esp, int status)
        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) {
@@ -467,12 +467,12 @@ eap_figure_next_state(eap_state *esp, int status)
                        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,
@@ -577,20 +577,20 @@ eap_figure_next_state(eap_state *esp, int status)
                        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)) {
@@ -651,17 +651,17 @@ eap_figure_next_state(eap_state *esp, int status)
        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) {
@@ -672,14 +672,14 @@ eap_figure_next_state(eap_state *esp, int status)
                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 {
@@ -689,14 +689,14 @@ eap_figure_next_state(eap_state *esp, int status)
 
        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 {
@@ -704,7 +704,7 @@ eap_figure_next_state(eap_state *esp, int status)
                }
                break;
 
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
        case eapMSCHAPv2Chall:
 #endif
        case eapMD5Chall:
@@ -722,12 +722,12 @@ eap_figure_next_state(eap_state *esp, int status)
        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
@@ -795,7 +795,7 @@ eap_chapms2_send_request(eap_state *esp, u_char id,
                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
@@ -810,13 +810,13 @@ eap_send_request(eap_state *esp)
        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 &&
@@ -882,7 +882,7 @@ eap_send_request(eap_state *esp)
                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];
@@ -903,9 +903,9 @@ eap_send_request(eap_state *esp)
                                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);
@@ -927,9 +927,9 @@ eap_send_request(eap_state *esp)
                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);
@@ -1058,7 +1058,7 @@ eap_send_request(eap_state *esp)
                BCOPY(esp->es_challenge, outp, esp->es_challen);
                INCPTR(esp->es_challen, outp);
                break;
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
 
        default:
                return;
@@ -1112,18 +1112,18 @@ eap_authpeer(int unit, char *localname)
 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) {
 
        /*
@@ -1161,7 +1161,7 @@ eap_server_timeout(void *arg)
        default:
                break;
        }
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
 
        /* EAP ID number must not change on timeout. */
        eap_send_request(esp);
@@ -1342,7 +1342,7 @@ eap_chap_response(eap_state *esp, u_char id, u_char *hash,
        output(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
 }
 
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
 /*
  * Format and send a SRP EAP Response message.
  */
@@ -1397,9 +1397,9 @@ eap_srpval_response(eap_state *esp, u_char id, u_int32_t flags, u_char *str)
 
        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
  */
@@ -1466,7 +1466,7 @@ eap_tls_sendack(eap_state *esp, u_char id)
 
        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)
@@ -1489,7 +1489,7 @@ 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)
 {
@@ -1596,9 +1596,9 @@ write_pseudonym(eap_state *esp, u_char *inp, int len, int id)
                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.
  */
@@ -1644,19 +1644,19 @@ eap_request(eap_state *esp, u_char *inp, int id, int len)
        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
@@ -1693,7 +1693,7 @@ eap_request(eap_state *esp, u_char *inp, int id, int len)
        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 &&
@@ -1719,7 +1719,7 @@ eap_request(eap_state *esp, u_char *inp, int id, int len)
                        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;
@@ -1791,7 +1791,7 @@ eap_request(eap_state *esp, u_char *inp, int id, int len)
                    esp->es_client.ea_namelen);
                break;
 
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
        case EAPT_TLS:
 
                switch(esp->es_client.ea_state) {
@@ -1859,7 +1859,7 @@ eap_request(eap_state *esp, u_char *inp, int id, int len)
 
                        /* 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);
@@ -1879,9 +1879,9 @@ eap_request(eap_state *esp, u_char *inp, int id, int len)
                }
 
                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");
@@ -2111,9 +2111,9 @@ eap_request(eap_state *esp, u_char *inp, int id, int len)
                        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");
@@ -2219,8 +2219,8 @@ eap_request(eap_state *esp, u_char *inp, int id, int len)
            }
 
            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) */
@@ -2241,7 +2241,7 @@ eap_request(eap_state *esp, u_char *inp, int id, int len)
                }
 
                break;
-#endif /* USE_PEAP */
+#endif // PPP_WITH_PEAP
 
        default:
                info("EAP: unknown authentication type %d; Naking", typenum);
@@ -2262,10 +2262,10 @@ client_failure:
                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 */
 }
 
 /*
@@ -2281,23 +2281,23 @@ eap_response(eap_state *esp, u_char *inp, int id, int len)
        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
@@ -2344,7 +2344,7 @@ eap_response(eap_state *esp, u_char *inp, int id, int len)
                eap_figure_next_state(esp, 0);
                break;
 
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
        case EAPT_TLS:
                switch(esp->es_server.ea_state) {
 
@@ -2374,7 +2374,7 @@ eap_response(eap_state *esp, u_char *inp, int id, int len)
                                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);
@@ -2400,7 +2400,7 @@ eap_response(eap_state *esp, u_char *inp, int id, int len)
                        break;
                }
                break;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
 
        case EAPT_NOTIFICATION:
                dbglog("EAP unexpected Notification; response discarded");
@@ -2433,14 +2433,14 @@ eap_response(eap_state *esp, u_char *inp, int id, int len)
                        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 */
@@ -2451,7 +2451,7 @@ eap_response(eap_state *esp, u_char *inp, int id, int len)
                        }
                        esp->es_server.ea_state = eapMSCHAPv2Chall;
                        break;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
 
                default:
                        dbglog("EAP: peer requesting unknown Type %d", vallen);
@@ -2534,7 +2534,7 @@ eap_response(eap_state *esp, u_char *inp, int id, int len)
                        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");
@@ -2637,9 +2637,9 @@ eap_response(eap_state *esp, u_char *inp, int id, int len)
                }
 
                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");
@@ -2740,7 +2740,7 @@ eap_response(eap_state *esp, u_char *inp, int id, int len)
                        break;
                }
                break;
-#endif /* USE_SRP */
+#endif /* PPP_WITH_SRP */
 
        default:
                /* This can't happen. */
@@ -2766,9 +2766,9 @@ static void
 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),
@@ -2776,7 +2776,7 @@ eap_success(eap_state *esp, u_char *inp, int id, int len)
                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)",
@@ -2784,7 +2784,7 @@ eap_success(eap_state *esp, u_char *inp, int id, int len)
                     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);
@@ -2795,7 +2795,7 @@ eap_success(eap_state *esp, u_char *inp, int id, int len)
                PRINTMSG(inp, len);
        }
 
-#ifdef USE_PEAP
+#ifdef PPP_WITH_PEAP
        peap_finish(&esp->ea_peap);
 #endif
 
@@ -2834,7 +2834,7 @@ eap_failure(eap_state *esp, u_char *inp, int id, int len)
 
        error("EAP: peer reports authentication failure");
 
-#ifdef USE_PEAP
+#ifdef PPP_WITH_PEAP
        peap_finish(&esp->ea_peap);
 #endif
 
@@ -2918,12 +2918,12 @@ eap_printpkt(u_char *inp, int inlen,
        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);
@@ -2988,7 +2988,7 @@ eap_printpkt(u_char *inp, int inlen,
                        }
                        break;
 
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
                case EAPT_MSCHAPV2:
                        if (len <= 0)
                                break;
@@ -3041,9 +3041,9 @@ eap_printpkt(u_char *inp, int inlen,
                                break;
                        }
                        break;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
 
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
                case EAPT_TLS:
                        if (len < 1)
                                break;
@@ -3059,9 +3059,9 @@ eap_printpkt(u_char *inp, int inlen,
                        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;
@@ -3149,7 +3149,7 @@ eap_printpkt(u_char *inp, int inlen,
                                break;
                        }
                        break;
-#endif  /* USE_SRP */
+#endif  /* PPP_WITH_SRP */
                }
                break;
 
@@ -3174,7 +3174,7 @@ eap_printpkt(u_char *inp, int inlen,
                        }
                        break;
 
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
                case EAPT_TLS:
                        if (len < 1)
                                break;
@@ -3191,7 +3191,7 @@ eap_printpkt(u_char *inp, int inlen,
                        printer(arg, flags & EAP_TLS_FLAGS_START ? "S":"- ");
 
                        break;
-#endif /* USE_EAPTLS */
+#endif /* PPP_WITH_EAPTLS */
 
                case EAPT_NAK:
                        if (len <= 0) {
@@ -3230,7 +3230,7 @@ eap_printpkt(u_char *inp, int inlen,
                        }
                        break;
 
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
                case EAPT_MSCHAPV2:
                        if (len <= 0)
                                break;
@@ -3273,9 +3273,9 @@ eap_printpkt(u_char *inp, int inlen,
                                break;
                        }
                        break;
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
 
-#ifdef USE_SRP
+#ifdef PPP_WITH_SRP
                case EAPT_SRP:
                        if (len < 1)
                                goto truncated;
@@ -3320,7 +3320,7 @@ eap_printpkt(u_char *inp, int inlen,
                                break;
                        }
                        break;
-#endif  /* USE_SRP */
+#endif  /* PPP_WITH_SRP */
                }
                break;
 
index 5d582bc6e2db60ad61ec194ec55347674dcffa8e..01697a8b4b85c1eb1d4945759d21ce2d16d095e5 100644 (file)
  * $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.
  */
@@ -124,13 +130,13 @@ enum eap_state_code {
        "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 && \
@@ -146,10 +152,10 @@ struct eap_auth {
        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 */
@@ -157,7 +163,7 @@ struct eap_auth {
        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
 };
@@ -169,7 +175,7 @@ typedef struct eap_state {
        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 */
@@ -185,12 +191,12 @@ typedef struct eap_state {
  * 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 */
 
index 162dace7e07915c62cc39198eb56be2b146dfe03..5a0df4d1468120fdf53f01ebb74a6c8e76ed43fa 100644 (file)
  *
  * $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 */
@@ -44,3 +52,5 @@ extern ecp_options ecp_allowoptions[];
 extern ecp_options ecp_hisoptions[];
 
 extern struct protent ecp_protent;
+
+#endif
index aa83e1a092b8abf28a31eb14fd85c1e5dba3eea5..f29200b818d7efd0fbfb1e2914a39255f99954b6 100644 (file)
  * 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]) && \
@@ -111,5 +79,4 @@ typedef union
 
 char *eui64_ntoa(eui64_t);     /* Returns ascii representation of id */
 
-#endif /* __EUI64_H__ */
-
+#endif /* PPP_EUI64_H */
index d23725c9e7eccb31620870c2063fd3896e83ac12..1cda6cffbde6b8addb4da1279689bc2b8caf153f 100644 (file)
@@ -41,6 +41,8 @@
  *
  * $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"
 
@@ -160,3 +162,5 @@ void fsm_sdata (fsm *, int, int, u_char *, int);
  * Variables
  */
 extern int peer_mru[];         /* currently negotiated peer MRU (per unit) */
+
+#endif
index 90336c4013cd1aaddb27409db28e9cef7c21f8a9..0e449319b64bf56336a16ea297999716302dfd84 100644 (file)
@@ -39,6 +39,9 @@
  * 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"
 
 /*
@@ -96,3 +99,5 @@ extern ipcp_options ipcp_hisoptions[];
 char *ip_ntoa(u_int32_t);
 
 extern struct protent ipcp_protent;
+
+#endif /* PPP_IPCP_H */
index 130819dc6f5256c9e5316e51d0f681f613862f50..5a99841429f67a8bbb57e5261a81b25a9bc865b9 100644 (file)
 
 #include "pppd.h"
 #include "fsm.h"
+#include "eui64.h"
 #include "ipcp.h"
 #include "ipv6cp.h"
 #include "magic.h"
index 3ce9df422eb53f3afd542c80fc7c04723b335ccc..172b6eb85794d6ba99475bb2012e787148c721aa 100644 (file)
  * 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 :
@@ -169,3 +173,5 @@ extern ipv6cp_options ipv6cp_allowoptions[];
 extern ipv6cp_options ipv6cp_hisoptions[];
 
 extern struct protent ipv6cp_protent;
+
+#endif
index 8a18e9516e0e121f019dc184fd6adabbb2b690c5..9dc883e47ce85a634df6c42b884a512379bd3559 100644 (file)
@@ -51,6 +51,7 @@
 #include "pppd.h"
 #include "fsm.h"
 #include "lcp.h"
+#include "eap.h"
 #include "chap-new.h"
 #include "magic.h"
 
@@ -76,10 +77,10 @@ bool        noendpoint = 0;         /* don't send/accept endpoint discriminator */
 
 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 */
@@ -162,7 +163,7 @@ static option_t lcp_option_list[] = {
     { "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 },
@@ -177,7 +178,7 @@ static option_t lcp_option_list[] = {
     { "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 },
@@ -303,7 +304,7 @@ noopt(char **argv)
     return (1);
 }
 
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
 static int
 setendpoint(char **argv)
 {
@@ -320,7 +321,7 @@ printendpoint(option_t *opt, void (*printer)(void *, char *, ...), void *arg)
 {
        printer(arg, "%s", epdisc_to_str(&lcp_wantoptions[0].endpoint));
 }
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
 
 /*
  * lcp_init - Initialize LCP.
@@ -1868,9 +1869,9 @@ lcp_up(fsm *f)
      */
     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),
@@ -2092,7 +2093,7 @@ lcp_printpkt(u_char *p, int plen, void (*printer)(void *, char *, ...), void *ar
                }
                break;
            case CI_EPDISC:
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
                if (olen >= CILEN_CHAR) {
                    struct epdisc epd;
                    p += 2;
index 768442d17464d7f33f53c1eca2b403fbec13d972..c01313d869aa59015ff95262b7ddea0f0949c53b 100644 (file)
@@ -39,6 +39,9 @@
  * 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"
 
 /*
@@ -132,3 +135,5 @@ extern struct protent lcp_protent;
 /* Default number of times we receive our magic number from the peer
    before deciding the link is looped-back. */
 #define DEFLOOPBACKFAIL        10
+
+#endif
index b864b7bc8ddb8b4dab7eb86eea7ab4d63d01920f..70e4ce528238390da2367aab47b01a3e075fe9b4 100644 (file)
@@ -39,6 +39,9 @@
  * 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 */
@@ -46,3 +49,5 @@ u_int32_t magic (void);       /* Returns the next magic number */
 
 /* Fill buffer with random bytes */
 void random_bytes (unsigned char *buf, int len);
+
+#endif
index 23294379119867d73d9dbe774f20170d945e0631..49319e2a81a7fbd4e8cc6cce5e131b931de8f1b6 100644 (file)
 #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
 
@@ -151,7 +153,7 @@ int ppp_session_number;             /* Session number, for channels with such a
                                   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
 
@@ -245,7 +247,7 @@ static void forget_child(int pid, int status);
 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 *);
@@ -267,11 +269,11 @@ struct protent *protocols[] = {
     &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,
@@ -292,12 +294,12 @@ main(int argc, char *argv[])
     struct protent *protp;
     char numbuf[16];
 
-    strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
-    strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
+    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);
@@ -383,7 +385,7 @@ main(int argc, char *argv[])
     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)
@@ -418,7 +420,7 @@ main(int argc, char *argv[])
      */
     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());
@@ -1180,7 +1182,7 @@ cleanup(void)
        (*the_channel->cleanup)();
     remove_pidfiles();
 
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
     if (pppdb != NULL)
        cleanup_db();
 #endif
@@ -1561,7 +1563,7 @@ safe_fork(int infd, int outfd, int errfd)
 
        /* Executing in the child */
        sys_close();
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
        if (pppdb != NULL)
                tdb_close(pppdb);
 #endif
@@ -2011,13 +2013,13 @@ script_setenv(char *var, char *value, int iskey)
     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);
@@ -2041,7 +2043,7 @@ script_setenv(char *var, char *value, int iskey)
     if (!add_script_env(i, newstring))
        return;
 
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
     if (pppdb != NULL) {
        if (iskey)
            add_db_key(newstring);
@@ -2065,7 +2067,7 @@ script_unsetenv(char *var)
        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
@@ -2073,7 +2075,7 @@ script_unsetenv(char *var)
            break;
        }
     }
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
     if (pppdb != NULL)
        update_db_entry();
 #endif
@@ -2091,7 +2093,7 @@ script_unsetenv(char *var)
  */
 void lock_db(void)
 {
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
        TDB_DATA key;
 
        key.dptr = PPPD_LOCK_KEY;
@@ -2105,7 +2107,7 @@ void lock_db(void)
  */
 void unlock_db(void)
 {
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
        TDB_DATA key;
 
        key.dptr = PPPD_LOCK_KEY;
@@ -2114,7 +2116,7 @@ void unlock_db(void)
 #endif
 }
 
-#ifdef USE_TDB
+#ifdef PPP_WITH_TDB
 /*
  * update_db_entry - update our entry in the database.
  */
@@ -2195,4 +2197,4 @@ cleanup_db(void)
        if (p[-1])
            delete_db_key(p);
 }
-#endif /* USE_TDB */
+#endif /* PPP_WITH_TDB */
index d67daeb820b3982fbaee9aae7cc95fae07b77e60..546ea02a8d6967affb32153ae60c1be6c815af07 100644 (file)
@@ -7,10 +7,11 @@
 ** (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
@@ -64,4 +65,4 @@ extern void MD4Final(unsigned char *, MD4_CTX *);
 ** End of md4.h
 ****************************(cut)***********************************/
 #endif  /* USE_MD4 */
-#endif  /* __MD4_INCLUDE__ */
+#endif  /* PPP_MD4_H */
index 662eb4126085c6f48ada54d41cea54ba7b2fd3e9..31f410dcf19c3911f38b7b3cd8266a7a867747bd 100644 (file)
  ** 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
@@ -67,4 +68,4 @@ void MD5_Update (MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen);
 void MD5_Final (unsigned char hash[], MD5_CTX *mdContext);
 
 #endif /* USE_MD5 */
-#endif /* __MD5_INCLUDE__ */
+#endif /* PPP_MD5_H */
index 2684a7f6fe85801b44eb978faa5a88567a040ba5..ade208f1d4b784ed2211cefb4c69cfcf0c3c14f1 100644 (file)
  * 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:
@@ -187,5 +187,5 @@ void mppe_set_chapv1(u_char *rchallenge, u_char PasswordHashHash[MD4_SIGNATURE_S
 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
index d4906c9506239101c4556a3239817aab0d7a2006..1fbe46e642c316b28096f557f5ed5dc83cae0551 100644 (file)
 #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
@@ -73,7 +75,7 @@
 #define DLT_PPP_PPPD   DLT_PPP
 #endif
 #endif
-#endif /* PPP_FILTER */
+#endif /* PPP_WITH_FILTER */
 
 #include "pppd.h"
 #include "pathnames.h"
@@ -131,22 +133,20 @@ int       child_wait = 5;         /* # seconds to wait for children at exit */
 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
@@ -173,18 +173,16 @@ static int showversion(char **);
 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 *);
@@ -335,7 +333,7 @@ option_t general_options[] = {
       "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 },
@@ -344,7 +342,7 @@ option_t general_options[] = {
       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,
@@ -356,14 +354,14 @@ option_t general_options[] = {
 
     { "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 },
 
@@ -371,7 +369,6 @@ option_t general_options[] = {
       "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 },
@@ -382,7 +379,6 @@ option_t general_options[] = {
       "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 },
@@ -1482,7 +1478,7 @@ callfile(char **argv)
     return ok;
 }
 
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
 /*
  * setpassfilter - Set the pass filter for packets
  */
@@ -1572,7 +1568,6 @@ setlogfile(char **argv)
     return 1;
 }
 
-#ifdef MAXOCTETS
 static int
 setmodir(char **argv)
 {
@@ -1589,9 +1584,8 @@ setmodir(char **argv)
     }
     return 1;
 }
-#endif
 
-#ifdef PLUGIN
+#ifdef PPP_WITH_PLUGINS
 static int
 loadplugin(char **argv)
 {
@@ -1644,7 +1638,7 @@ loadplugin(char **argv)
        free(path);
     return 0;
 }
-#endif /* PLUGIN */
+#endif /* PPP_WITH_PLUGINS */
 
 /*
  * Set an environment variable specified by the user.
diff --git a/pppd/patchlevel.h b/pppd/patchlevel.h
deleted file mode 100644 (file)
index 1ecdb82..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#define DATE           "5 January 2021"
index 915db67a0b8f5d32314df297c89fc2afbbed8ebb..57a130e1c2e3b4278226366aa2c9c58e2edcd87e 100644 (file)
@@ -1,6 +1,9 @@
 /*
  * 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"
@@ -59,7 +62,7 @@
 #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
@@ -70,3 +73,4 @@
 #define _PATH_PPPDB    _PPP_VARRUN "pppd2.tdb"
 #endif /* __STDC__ */
 
+#endif /* PPP_PATHNAMES_H */
index fb9af3e22ebcecd26ffcd102ebfed3294e57a51c..d6e5fcff9012edc68f5e902808b44a9164e91a1b 100644 (file)
@@ -56,7 +56,6 @@
 #include <openssl/hmac.h>
 #include <openssl/rand.h>
 #include <openssl/err.h>
-#include <net/ppp_defs.h>
 
 #include "pppd.h"
 #include "eap.h"
@@ -85,7 +84,7 @@ struct peap_state {
        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
 };
@@ -162,7 +161,7 @@ static void generate_cmk(u_char *ipmk, u_char *tempkey, u_char *nonce, u_char *t
        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
@@ -192,7 +191,7 @@ static void verify_compound_mac(struct peap_state *psm, u_char *in_buf)
                        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)
@@ -310,7 +309,7 @@ void peap_do_inner_eap(u_char *in_buf, int in_len, eap_state *esp, int id,
                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
@@ -337,7 +336,7 @@ void peap_do_inner_eap(u_char *in_buf, int in_len, eap_state *esp, int id,
                used += 2;
                break;
 
-#if CHAPMS
+#if PPP_WITH_CHAPMS
        case EAPT_MSCHAPV2: {
 
                // Must have at least 4 more bytes to process CHAP header
index 49e28e8375f321f9d6142b352070dc01dd7d1213..f11312ebfc6f857681cd9dbb59a337a06752c474 100644 (file)
@@ -30,6 +30,8 @@
 #ifndef PPP_PEAP_H
 #define        PPP_PEAP_H
 
+#include "pppdconf.h"
+
 #define        PEAP_PHASE_1                    1
 #define        PEAP_PHASE_2                    2
 
index cfc9164bcd27cd2056f73ebd97059bc652e56f18..2826148c79ffb79f71711bf86e76b07b2c0e9c65 100644 (file)
@@ -1,7 +1,7 @@
 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)
index 40855ee1673637f565b6b19913bfd8b02f7958ba..82bef4890931ea2ad496e43f50752b5017ecd68d 100644 (file)
  * 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;
 
index 743c087b47805ea002b026dd7cf36a6b2ef5afb4..14a199f8c743e574a71538d996998fd0361fcafe 100644 (file)
@@ -9,17 +9,15 @@
  *  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;
@@ -124,7 +122,7 @@ void plugin_init(void)
 {
     add_options(options);
     pap_passwd_hook = promptpass;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
     eaptls_passwd_hook = promptpass;
 #endif
 }
index 84fd72e3b9b6994a43d112410de3312744cdf3bc..6f8bc6f0be78265838f8f5733833f4c974fe7e82 100644 (file)
@@ -7,18 +7,14 @@
  *  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];
@@ -84,7 +80,7 @@ void plugin_init (void)
     chap_check_hook = pwfd_check;
     chap_passwd_hook = pwfd_passwd;
 
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
     eaptls_passwd_hook = pwfd_passwd;
 #endif
 }
index 66119c95b271aa511fab8d2f23f2c837a848aca7..1bc77c19fee36b56d09453bc6392d7cf1c658948 100644 (file)
@@ -6,7 +6,7 @@ noinst_HEADERS = \
     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
 
index 09cd0b8bfb0142524d12c15971f8e13844e7e6b0..5ac03c8483d66e44f40da04f1ab7f7290b3a72c0 100644 (file)
  *  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;
@@ -89,7 +89,7 @@ static int setdevname_pppoatm(const char *cp, const char **argv, int doit)
                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;
@@ -163,7 +163,7 @@ static int connect_pppoatm(void)
        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;
 }
index 0d70380a13893385dafcacc9aa8cd4b70505f62e..6cea70aae967c96fd17b9e9a3749febdeeae3cbf 100644 (file)
@@ -6,9 +6,9 @@ dist_man8_MANS = pppoe-discovery.8
 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
index 9ddbcbd47f3202045c01141f9157f422840d77e8..31811f59a9fbf3af05d79ff94f698ed5d7a0d321 100644 (file)
@@ -17,12 +17,12 @@ static char const RCSID[] =
 "$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>
diff --git a/pppd/plugins/pppoe/config.h.in b/pppd/plugins/pppoe/config.h.in
new file mode 100644 (file)
index 0000000..0c4d9da
--- /dev/null
@@ -0,0 +1,56 @@
+/* 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
+
index b32b0c891dcd89c5fb46ebe402adc698f9a0611f..a5c2c62fdc383738edf8d5edb65101a6cc5b3b98 100644 (file)
@@ -12,14 +12,14 @@ static char const RCSID[] =
 "$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>
index 3dfea8c0fa20347c0c0a78c35cb386d6989b974b..a3c384815ce2552055a152169293062af073b697 100644 (file)
@@ -17,12 +17,12 @@ static char const RCSID[] =
 "$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>
index c53450752b7c481fda436891622ebdac2cdc9c6b..92d049353c49b24b6bb81f295a37317cfd1cd778 100644 (file)
@@ -26,24 +26,18 @@ static char const RCSID[] =
 "$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>
@@ -54,13 +48,20 @@ static char const RCSID[] =
 #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;
@@ -200,7 +201,7 @@ PPPOEConnectDevice(void)
 
     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;
@@ -395,7 +396,7 @@ PPPoEDevnameHook(char *cmd, char **argv, int doit)
     /* 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;
@@ -427,7 +428,7 @@ plugin_init(void)
 
     add_options(Options);
 
-    info("PPPoE plugin from pppd %s", VERSION);
+    info("PPPoE plugin from pppd %s", PPPD_VERSION);
 }
 
 void pppoe_check_options(void)
index 10f51dc975dbd9df1a851ca056f586770e09aa8d..b698bca7b17fd56d68fa7e30c8de353056d41ad5 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdarg.h>
@@ -21,6 +21,7 @@
 #include <string.h>
 #include <time.h>
 #include <signal.h>
+#include <sys/time.h>
 
 #include "pppoe.h"
 
@@ -207,7 +208,7 @@ int main(int argc, char *argv[])
                        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);
@@ -269,5 +270,5 @@ usage(void)
            "   -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");
 }
index 26e14f5d9f4fade2857887b4ee600e39abce00fa..1517e34f61ba07870113beff724885e654ef4d60 100644 (file)
@@ -18,7 +18,7 @@
 #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
index 999f35b3b1881454e9d56f38703351679b6fcf79..1018981f0b4a0f19f734bbf9284559ba3a5790ff 100644 (file)
@@ -4,10 +4,10 @@ pppd_plugindir = $(PPPD_PLUGIN_DIR)
 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
index 0f9db6d5ecc34e268206d1b55d4205881172b0fa..2ba870716f62a3908f3b9098bdff4ac104e7c656 100644 (file)
 
 /* 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)))
@@ -63,7 +62,7 @@ extern void (*pppol2tp_send_accm_hook)(int tunnel_id, int session_id,
                                       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;
 
index c9902afed2f8e24f79cb3c688ad495b01d989876..c1eaa9afeb88e23df5ecdc52fd51ca21cb1e0aa9 100644 (file)
  *  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);
 
index c3cff2347b4d77e157c37fc5ecc7a521c8f47580..ec637ae7897e17ed85c020fbcf4de3f9e6c93004 100644 (file)
@@ -25,7 +25,7 @@ EXTRA_ETC = \
     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)
index f48d9b741e133c506bc5d1e46d0999ac47f264a2..1e6d87a9173086202eb9fb32b6ea678e8abe3f09 100644 (file)
@@ -47,7 +47,7 @@
 
 #include <time.h>
 
-#include "magic.h"
+#include <pppd/magic.h>
 
 /* rlib/lock.c */
 int do_lock_exclusive(int);
index 8af03aa3713e922302a7c9e289e093a82a669f51..8acfb38c49a3a9e791f87ceccb9eedcabd067cbc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * $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)
 {
index f6a787424afc4fc304f605fb02467b4d055d9700..16f7fba0f1b1680bf986971ee9818291dd50367c 100644 (file)
 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
index 6a5b1b83ff8f0cd8b88175dfb58d970f2e10a012..02875b4fec2069de9d31339b80df793bf8a709e5 100644 (file)
 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
@@ -97,7 +96,7 @@ static int radius_init(char *msg);
 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);
@@ -140,7 +139,7 @@ void (*radius_pre_auth_hook)(char const *user,
 
 static struct radius_state rstate;
 
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
 
 /**********************************************************************
 * %FUNCTION: plugin_init
@@ -346,7 +345,7 @@ radius_chap_verify(char *user, char *ourname, int id,
     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
@@ -365,7 +364,7 @@ radius_chap_verify(char *user, char *ourname, int id,
 
     /* 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
@@ -412,7 +411,7 @@ radius_chap_verify(char *user, char *ourname, int id,
                      cpassword, MD5_HASH_SIZE + 1, VENDOR_NONE);
        break;
 
-#ifdef CHAPMS
+#ifdef PPP_WITH_CHAPMS
     case CHAP_MICROSOFT:
     {
        /* MS-CHAP-Challenge and MS-CHAP-Response */
@@ -544,7 +543,7 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info,
 {
     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;
@@ -607,7 +606,6 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info,
                /* idle parameter */
                idle_time_limit = vp->lvalue;
                break;
-#ifdef MAXOCTETS
            case PW_SESSION_OCTETS_LIMIT:
                /* Session traffic limit */
                maxoctets = vp->lvalue;
@@ -616,7 +614,6 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info,
                /* 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;
@@ -662,7 +659,7 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info,
 
 
        } 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)) {
@@ -674,7 +671,7 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info,
                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,
@@ -704,7 +701,7 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info,
                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);
@@ -732,7 +729,7 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info,
                break;
 #endif /* MSDNS */
            }
-#endif /* CHAPMS */
+#endif /* PPP_WITH_CHAPMS */
        }
        vp = vp->next;
     }
@@ -741,7 +738,7 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info,
     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!
@@ -758,7 +755,7 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info,
     return 0;
 }
 
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
 /**********************************************************************
 * %FUNCTION: radius_setmppekeys
 * %ARGUMENTS:
@@ -880,7 +877,7 @@ radius_setmppekeys2(VALUE_PAIR *vp, REQUEST_INFO *req_info)
 
     return 0;
 }
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
 
 /**********************************************************************
 * %FUNCTION: radius_acct_start
@@ -1090,11 +1087,9 @@ radius_acct_stop(void)
            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;
index 87e6e0a3c8d22ede405570375ca9520f1d43b54c..96449be22cab468abb3ba695fe9f2f93296e8adb 100644 (file)
 #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... */
index a3b9a513bb53ab93a59e25e7d01e4b4930d3cf99..27955e06d079c4a9caaee048a7fe3cc490ae7a06 100644 (file)
 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";
 
index 76db234737e93876f38d97171ab3877aea19c729..71c0d038fbaa4e852ddfd90a3c7d0fae72e5c54f 100644 (file)
 *
 ***********************************************************************/
 
-#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
@@ -104,7 +101,7 @@ static int winbind_chap_verify(char *user, char *ourname, int id,
                               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
@@ -569,14 +566,14 @@ winbind_chap_verify(char *user, char *ourname, int id,
                        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 */
@@ -590,7 +587,7 @@ winbind_chap_verify(char *user, char *ourname, int id,
                                  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");
@@ -637,7 +634,7 @@ winbind_chap_verify(char *user, char *ourname, int id,
                                &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
index 79676ca902342c7b07bb92231ef2f6ab21a19ec5..fff396c4c1d8bb0b8c38046e4b4143028c33adf5 100644 (file)
  * 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>
@@ -46,4 +46,4 @@ extern bool   DesSetkey(u_char *);
 extern bool    DesEncrypt(u_char *, u_char *);
 extern bool    DesDecrypt(u_char *, u_char *);
 
-#endif /* PPPCRYPT_H */
+#endif /* PPP_PPPCRYPT_H */
index e54a526e57f36eb2ac8b1b89088f1b681688f607..bd9faf0f993396742e87862d076b86e9be672b5b 100644 (file)
  * $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
 
 /*
@@ -219,7 +243,7 @@ struct notifier {
 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 */
@@ -234,7 +258,7 @@ extern int  privileged;     /* We were run by real-uid root */
 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 */
@@ -249,7 +273,7 @@ extern int  unsuccess;      /* # unsuccessful connection attempts */
 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 */
@@ -283,7 +307,7 @@ extern struct notifier *fork_notifier;      /* we are a new child process */
 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 */
@@ -322,14 +346,14 @@ extern char       *pty_socket;    /* Socket to connect to pty */
 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 */
@@ -337,13 +361,12 @@ extern bool       dump_options;   /* print out option values */
 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"
@@ -357,13 +380,12 @@ extern char *cacert_file;
 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)
@@ -377,14 +399,13 @@ extern int       maxoctets_timeout;  /* Timeout for check of octets limit */
 #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
@@ -625,7 +646,7 @@ int  loop_chars(unsigned char *, int); /* process chars from loopback */
 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 */
@@ -693,7 +714,7 @@ int  sifaddr(int, u_int32_t, u_int32_t, u_int32_t);
                                /* 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);
@@ -705,7 +726,7 @@ int  sifdefaultroute(int, u_int32_t, u_int32_t, bool replace_default_rt);
                                /* Create default route through i/f */
 int  cifdefaultroute(int, u_int32_t, u_int32_t);
                                /* Delete default route through i/f */
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 int  sif6defaultroute(int, eui64_t, eui64_t);
                                /* Create default IPv6 route through i/f */
 int  cif6defaultroute(int, eui64_t, eui64_t);
@@ -723,7 +744,7 @@ void logwtmp(const char *, const char *, const char *);
                                /* 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
@@ -781,7 +802,7 @@ extern int (*chap_check_hook)(void);
 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
 
@@ -872,9 +893,7 @@ extern void (*snoop_send_hook)(unsigned char *p, int len);
 #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
 
 /*
@@ -968,4 +987,4 @@ extern void (*snoop_send_hook)(unsigned char *p, int len);
 #define offsetof(type, member) ((size_t) &((type *)0)->member)
 #endif
 
-#endif /* __PPP_H__ */
+#endif /* PPP_PPPD_H */
index 9c0dacbb28fee9fd3b0048daf2d86d2a54f45207..64c37f7f6c97b77f49535a53a216a0761c01b375 100644 (file)
@@ -3,44 +3,47 @@
  *   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
@@ -54,5 +57,7 @@
 /* Use included sha included with pppd */
 #undef USE_SHA
 
-/* Version number of package */
-#undef VERSION
+/* The pppd version */
+#undef PPPD_VERSION
+
+#endif
index 3d1fb6d7ccc1f912e1454eacdd10e20f2a22626d..8ab5b8b294d7f37ddd95c865fe37a3dca70b630e 100644 (file)
@@ -92,9 +92,9 @@
 #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
@@ -167,17 +167,17 @@ static struct pam_conv pam_conv_data = {
     &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
@@ -185,7 +185,7 @@ session_start(const int flags, const char *user, const char *passwd, const char
     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);
 
@@ -199,7 +199,7 @@ session_start(const int flags, const char *user, const char *passwd, const char
        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)
@@ -295,7 +295,7 @@ session_start(const int flags, const char *user, const char *passwd, const char
     /* 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
@@ -359,7 +359,7 @@ session_start(const int flags, const char *user, const char *passwd, const char
             return SESSION_FAILED;
     }
 
-#endif /* #ifdef USE_PAM */
+#endif /* #ifdef PPP_WITH_PAM */
 
     /*
      * Write a wtmp entry for this user.
@@ -371,7 +371,7 @@ session_start(const int flags, const char *user, const char *passwd, const char
        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
@@ -393,7 +393,7 @@ session_start(const int flags, const char *user, const char *passwd, const char
                 (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);
     }
 
@@ -406,7 +406,7 @@ session_start(const int flags, const char *user, const char *passwd, const char
 void
 session_end(const char* ttyName)
 {
-#ifdef USE_PAM
+#ifdef PPP_WITH_PAM
     int pam_error = PAM_SUCCESS;
 
     if (pamh != NULL) {
index 0047db6646ffe5042b7ab9389211e65db58d12c2..0b91a03e5d62e5c921540c4fb92862e44b08b41a 100644 (file)
  * 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 */
@@ -89,4 +89,4 @@ session_start(const int flags, const char* user, const char* passwd, const char*
 void
 session_end(const char* tty);
 
-#endif
+#endif // PPP_SESSION_H
index efb37bec40fe5b3ba0f0c456028cc887532f47eb..4fc53458c076312170f5632c2593851305dae271 100644 (file)
@@ -23,7 +23,6 @@
 #include <string.h>
 #include <time.h>
 #include <netinet/in.h>        /* htonl() */
-#include <net/ppp_defs.h>
 #include "sha1.h"
 
 static void
index e7e557308ee8e1f446c4295cc09d1c84bfda5e75..2325133251177e098a1bd2ad95ac125d42d87ba4 100644 (file)
@@ -1,9 +1,9 @@
 /* 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>
@@ -32,4 +32,4 @@ extern void SHA1_Update(SHA1_CTX *, const unsigned char *, unsigned int);
 extern void SHA1_Final(unsigned char[SHA1_SIGNATURE_SIZE], SHA1_CTX *);
 
 #endif /* USE_SHA */
-#endif /* __SHA1_INCLUDE_ */
+#endif /* PPP_SHA1_H */
index 38e7bcc6cdc3b2be41b312881bd746420acf5d97..b36d2a84d8a49f839ee0d3a987be9ebf3a33814c 100644 (file)
@@ -1,7 +1,7 @@
-#include "pppdconf.h"
+#ifndef PPP_SPINLOCK_H
+#define PPP_SPINLOCK_H
 
-#ifndef __SPINLOCK_H__
-#define __SPINLOCK_H__
+#include "pppdconf.h"
 
 #include "tdb.h"
 
@@ -54,4 +54,4 @@ int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
 
 #endif
 
-#endif
+#endif // PPP_SPINLOCK_H
index 6eed86f3f2a2b0bd6f1754375d1c6734380ce6a2..e7f851c02512394cc1ebe5b63f771eb4890846b4 100644 (file)
@@ -81,6 +81,7 @@
 #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>
 
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 #include <linux/if_link.h>
 
-#ifdef INET6
-#include <linux/if_addr.h>
-#endif
-
 /* Attempt at retaining compile-support with older than 4.7 kernels, or kernels
  * where RTM_NEWSTATS isn't defined for whatever reason.
  */
 #define IFLA_STATS_LINK_64 1
 #endif
 
+#include <linux/if_addr.h>
+
 /* glibc versions prior to 2.24 do not define SOL_NETLINK */
 #ifndef SOL_NETLINK
 #define SOL_NETLINK 270
 #include "fsm.h"
 #include "ipcp.h"
 
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_IPV6CP
+#include "eui64.h"
+#endif /* PPP_WITH_IPV6CP */
+
+#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.
@@ -200,7 +202,7 @@ struct in6_ifreq {
        } 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)
@@ -212,9 +214,9 @@ static int ppp_fd = -1;             /* fd which is set to PPP discipline */
 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.
@@ -357,7 +359,7 @@ void sys_init(void)
     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 */
@@ -383,15 +385,17 @@ void sys_cleanup(void)
        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
@@ -411,7 +415,7 @@ sys_close(void)
        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
@@ -1612,7 +1616,7 @@ void ccp_flags_set (int unit, int isopen, int isup)
                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.
  */
@@ -1637,7 +1641,7 @@ int set_filters(struct bpf_program *pass, struct bpf_program *active)
        }
        return 1;
 }
-#endif /* PPP_FILTER */
+#endif /* PPP_WITH_FILTER */
 
 /********************************************************************
  *
@@ -1662,20 +1666,21 @@ get_ppp_stats_ioctl(int u, struct pppd_stats *stats)
     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;
@@ -2293,7 +2298,7 @@ int cifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
     return 1;
 }
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 /*
  * /proc/net/ipv6_route parsing stuff.
  */
@@ -2483,7 +2488,7 @@ int cif6defaultroute (int unit, eui64_t ouraddr, eui64_t gateway)
 
     return 1;
 }
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
 
 /********************************************************************
  *
@@ -3109,15 +3114,15 @@ int sifdown (int u)
     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
@@ -3148,7 +3153,7 @@ int sif6down (int u)
 
     return setifstate(u, 0);
 }
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
 
 /********************************************************************
  *
@@ -3336,7 +3341,7 @@ int cifaddr (int unit, u_int32_t our_adr, u_int32_t his_adr)
     return 1;
 }
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 /********************************************************************
  *
  * sif6addr_rtnetlink - Config the interface with both IPv6 link-local addresses via rtnetlink
@@ -3597,7 +3602,7 @@ int cif6addr (int unit, eui64_t our_eui64, eui64_t his_eui64)
     }
     return 1;
 }
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
 
 /*
  * get_pty - get a pty master/slave pair and chown the slave side
index 809b506a3640d34879fd8d9be303912bc81b5caa..d903721de9659b76653f1b57e29d16001de30677 100644 (file)
 #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) */
@@ -190,7 +194,7 @@ static int  fdmuxid = -1;
 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 */
@@ -224,11 +228,11 @@ 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;
@@ -297,7 +301,7 @@ sifppa(fd, ppa)
 }
 #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.
@@ -477,7 +481,7 @@ get_first_ether_hwaddr(u_char *addr)
     else
        return -1;
 }
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
 
 #if defined(SOL2)
 /*
@@ -506,7 +510,7 @@ get_if_hwaddr(u_char *addr, char *if_name)
 }
 #endif /* SOL2 */
 
-#if defined(SOL2) && defined(INET6)
+#if defined(SOL2) && defined(PPP_WITH_IPV6CP)
 /*
  * slifname - Sets interface ppa and flags
  *
@@ -536,7 +540,7 @@ slifname_done:
 
 
 }
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
 
 /*
  * sys_init - System-dependent initialization.
@@ -546,10 +550,10 @@ sys_init(void)
 {
     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;
@@ -561,11 +565,11 @@ sys_init(void)
     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);
@@ -604,7 +608,7 @@ sys_init(void)
        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);
@@ -614,14 +618,14 @@ sys_init(void)
        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");
     }
 
@@ -631,13 +635,13 @@ sys_init(void)
      */
     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
@@ -659,14 +663,14 @@ sys_init(void)
        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");
     }
 
@@ -683,9 +687,9 @@ sys_init(void)
      */
     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");
     }
 
@@ -703,7 +707,7 @@ sys_init(void)
        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) {
@@ -723,7 +727,7 @@ sys_init(void)
        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. */
@@ -746,15 +750,15 @@ sys_cleanup(void)
 {
 #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)
@@ -786,7 +790,7 @@ sys_cleanup(void)
        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.
@@ -808,7 +812,7 @@ sys_cleanup(void)
     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) */
 }
 
@@ -819,9 +823,9 @@ void
 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);
 }
@@ -1462,10 +1466,10 @@ void
 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));
@@ -1474,7 +1478,7 @@ netif_set_mtu(int unit, int mtu)
        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");
@@ -1487,7 +1491,7 @@ netif_set_mtu(int unit, int mtu)
        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) */
 }
 
 
@@ -1754,7 +1758,7 @@ sifnpmode(int u, int proto, enum NPmode mode)
     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.
  */
@@ -1938,7 +1942,7 @@ cif6defaultroute(int u, eui64_t l, eui64_t g)
     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)
index 418bd8d9d3496d4b4ef90223e908f98abf463eba..1d7d7656238b8d2a8863d186b4ca725097c8ce8f 100644 (file)
@@ -1,7 +1,7 @@
-#include "pppdconf.h"
+#ifndef PPP_TDB_H
+#define PPP_TDB_H
 
-#ifndef __TDB_H__
-#define __TDB_H__
+#include "pppdconf.h"
 
 /* 
    Unix SMB/CIFS implementation.
@@ -163,4 +163,4 @@ extern TDB_DATA tdb_null;
 }
 #endif
 
-#endif /* tdb.h */
+#endif /* PPP_TBD_H */
index 9c79d16974f97d84e71ebb6cd645cdb11c3764d1..a234d305425b3da130b26d4f668f5162eb57a0f3 100644 (file)
@@ -6,8 +6,10 @@
  * 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
@@ -191,4 +193,4 @@ static void cfmakeraw(struct termios *t)
        t->c_cflag |= CS8;
 }
 
-#endif /* _TERMIOS_LINUX_H_ */
+#endif /* PPP_TERMIOS_LINUX_H */
index 39fdef7739894ffa16783fff67fb610bb7c7344b..0796779456f4204362ec9306111fde7a5b9bb60b 100644 (file)
  * 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
@@ -85,4 +87,4 @@ int tls_set_ca(SSL_CTX *ctx, const char *ca_dir, const char *ca_file);
  */
 void tls_log_sslerr( void );
 
-#endif /* TLS_H */
+#endif /* PPP_TLS_H */
index 7e208badaff078c20c3ed8345c12778c769f5fbf..ad743539ec806c8fcfa2b7cfc9ea95195c063bf8 100644 (file)
@@ -319,7 +319,7 @@ setdevname(char *cp, char **argv, int doit)
        }
 
        if (doit) {
-               strlcpy(devnam, cp, sizeof(devnam));
+               strlcpy(devnam, cp, MAXPATHLEN);
                devstat = statbuf;
                default_device = 0;
        }
@@ -414,7 +414,7 @@ void tty_process_extra_options(void)
                        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);
        }
@@ -518,7 +518,7 @@ int connect_tty(void)
         * 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;
index 709cd6294ffd2bf216799da3284518bea0238a2c..af09cd914176225a76a1fd6ef28ff760660e84a0 100644 (file)
  * 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.
@@ -108,3 +112,5 @@ void upap_authwithpeer(int, char *, char *);
 void upap_authpeer(int);
 
 extern struct protent pap_protent;
+
+#endif // PPP_UPAP_H
index 2df7e0edd190d0db6021f51bfe82f7185f886c03..186f34e00e259d7837a365d8bdd4372d2dcab802 100644 (file)
@@ -2,7 +2,6 @@ sbin_PROGRAMS = pppdump
 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 \
index 9d45f0bf610d8aa3a1da7e6f0c2f254bb1745578..57f936c5ed0004650f43a928eaf98f66aaa00041 100644 (file)
@@ -46,7 +46,7 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-#include "ppp_defs.h"
+
 #include "ppp-comp.h"
 
 #if DO_BSD_COMPRESS
@@ -250,14 +250,15 @@ bsd_comp_stats(void *state, struct compstat *stats)
     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;
 }
 
 /*
index 5668a4d88067f66c86f1ad6a9e06585711f117ef..ebc16921fd6ac710778869050306bd6f5b253162 100644 (file)
@@ -41,7 +41,7 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-#include "ppp_defs.h"
+
 #include "ppp-comp.h"
 #include "zlib.h"
 
@@ -115,12 +115,13 @@ z_comp_stats(void *arg, struct compstat *stats)
     *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;
 }
 
 /*
index 4046a1f94c992f60320198d0cf0da0fc8de1490f..0199b5fa7b5086166b0997335037296a904bfc1f 100644 (file)
 #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.
  */
index 130300a17d348046dbc4a81100f8fbfcf3d9f0a5..b85a86271edacafcbae3f7329bce4e08bf5b0b94 100644 (file)
@@ -38,7 +38,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include <sys/types.h>
-#include "ppp_defs.h"
+
 #include "ppp-comp.h"
 
 int hexmode;
@@ -233,6 +233,7 @@ static u_short fcstab[256] = {
        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;
@@ -296,6 +297,10 @@ dumpppp(f)
                            printf("%s aborted packet:\n     ", dir);
                            q = "    ";
                        }
+                       if (pkt->cnt >= sizeof(pkt->buf)) {
+                           printf("%s over-long packet truncated:\n     ", dir);
+                           q = "    ";
+                       }
                        nb = pkt->cnt;
                        p = pkt->buf;
                        pkt->cnt = 0;
@@ -399,7 +404,8 @@ dumpppp(f)
                        c ^= 0x20;
                        pkt->esc = 0;
                    }
-                   pkt->buf[pkt->cnt++] = c;
+                   if (pkt->cnt < sizeof(pkt->buf))
+                       pkt->buf[pkt->cnt++] = c;
                    break;
                }
            }
index d7d74e0200abc68407a0dde1c06614a63ed3b60c..4c8b83fa0186804cfc1aa6007ab5476801e29376 100644 (file)
@@ -5,10 +5,6 @@ pppstats_SOURCES = pppstats.c
 pppstats_CFLAGS =
 pppstats_CPPFLAGS =
 
-if LINUX
-pppstats_CFLAGS += -I${top_srcdir}/include
-endif
-
 if SUNOS
 pppstats_CPPFLAGS += -DSTREAMS
 endif
index cbea00b6d71268a1838ffd11428618c217a19cdc..44a254d70154f5d00ff03727419ef87eb1693623 100644 (file)
@@ -62,7 +62,6 @@ static const char rcsid[] = "$Id: pppstats.c,v 1.29 2002/10/27 12:56:26 fcusack
 #ifndef __linux__
 #include <net/if.h>
 #include <net/ppp_defs.h>
-#include <net/if_ppp.h>
 #else
 /* Linux */
 #if __GLIBC__ >= 2
@@ -74,6 +73,7 @@ static const char rcsid[] = "$Id: pppstats.c,v 1.29 2002/10/27 12:56:26 fcusack
 #endif
 #include <linux/ppp_defs.h>
 #include <linux/if_ppp.h>
+
 #endif /* __linux__ */
 
 #else  /* STREAMS */
@@ -137,15 +137,11 @@ catchalarm(int arg)
 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;
@@ -157,25 +153,21 @@ get_ppp_stats(struct ppp_stats *curp)
            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");
@@ -189,28 +181,26 @@ get_ppp_cstats(struct ppp_comp_stats *csp)
     }
 
 #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 */