pppd: constify log format strings. (#462) Found when trying to do a simple dbglog(__FUNCTION__); Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Change my paulus@samba.org email address to paulus@ozlabs.org Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
pppd: implement net-init, net-pre-up and net-down. net-init executes as a blocking script directly after the unit number becomes available. This can be used to initialise aspects related to the ppp connection that lives outside of the ppp connection. It can also be used to clean up (in the author's extremely unlikely case) where a previous pppd crashed, and net-down didn't execute in order to clean up. net-pre-up executes as a blocking script after auth, prior to NCPs being negotiated. Unlike ip-pre-up this is guaranteed to execute prior to the interface being brought up, and can be used in an NCP agnostic manner to pre-initialise aspects of the interface for which it still needs to be down (amongst others it's recommended that firewall changes happen here). net-down executes in a non-blocking manner just prior to pppd terminating and can be used to clean up actions from previous scripts. You will notice that I mention ip-pre-up doesn't gaurantee that the interface will still be down, this is because in a Linux world all protocols runs on the same interface, compared to solaris where I'm informed each protocol runs on it's own sub-interface, each of which has it's own operational state. The man page for pppd has also been adjusted to indicate as much. Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Ensure there is a '/' between PPP_PATH_VARRUN and the PID filename (#427) Bug: https://bugs.gentoo.org/907311 Fixes: 66a8c74c3f73 ("Let ./configure control the paths for pppd", 2022-07-30) Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Fix compilation without ipv6cp support (#408) You can't reference variables that aren't included in the compile. Add #ifdef PPP_WITH_IPV6CP in the get_notifier_by_type function. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
pppd: Should check name, not ifname in ppp_set_ifname (#396) Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Header file reorganization and cleaning up the public API for pppd version 2.5.0 (#379) This commit does several things, being a squash-and-merge of a series of changes; squashed in order not to break bisection. * Clean up pppd.h, moving declarations that should only be accessed by pppd code (not by users of pppd) to a new pppd-private.h. Also, other parts of pppd.h were moved to multilink.h, chap.h, eap.h, eui64.h, and a new options.h. * Provide an API for access to data that is needed by plugins (in no particular order): - ifname - ifunit - remote_name - remote_number - peer_authname - status (now called "code" internally) - phase - doing_multilink - multilink_master - idle_time_limit - link_connect_time - max_connect_time - link_stats - ipparam - hostname - got_sigterm - got_sigusr2 - got_sighup - session_number - maxoctets - maxoctets_dir - debug - persist - devnam - modem - peer_authname - sync_serial * Update the version number to 2.5.0. * Detect availability of stddef.h and stdarg.h. * Rename some headers: - pppcrypt.c/h to crypto_ms.c/h - ppp-crypto.c/h to crypto.c/h - ppp-crypto-priv.h to crypto-priv.h - chap-new.c/h to chap.c/h * Remove chap-md5.h, crypto-priv.h, eap-tls.h, etc. from the list of header files to be installed. * Provide typedefs for the hook functions. * Provide a typedef for the "phase" variable. * Provide a typedef for the link statistics array. * Remove the option_t typedef. * Rename the following functions by adding a "ppp_" prefix (with the intention that these are a "public" API for use by plugins): - option_error - add_options - int_option, - options_from_file - script_setenv - bad_ip_adrs, - netif_get/set_mtu (renamed to ppp_get/set_mtu) - get_time - timeout - untimeout - safe_fork - sys_close - set_session_number - update_link_stats (renamed to ppp_get_link_stats) - add_notifier (renamed to ppp_add_notify) - remove_notifier (renamed to ppp_del_notify) - generic_[dis]establish_ppp (to ppp_generic_[dis]establish) * Rename ppp_devnam to ppp_devname. * Rename ppp_available() to ppp_check_kernel_support(). * Use unsigned char instead of u_char, unsigned short instead of u_short, uint32_t instead of u_int32_t. * Add const to some declarations * Update comments * Change the interface for notifiers to use an enum to identify which notifier is to be modified. * Provide an API for getting the path to a file, with an enum to identify different types of file. * Link plugins with the -DPLUGIN flag [paulus@ozlabs.org - wrote commit message] Signed-off-by: Eivind Næss <eivnaes@yahoo.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Merge pull request #365 from enaess/ppp-options Add option to show all options (show-options)
Add option to show all options (show-options), and fixing up the version text to include copyright and package name from autotools. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Create a new API to abstract the crypto functions used by pppd. This re-introduces the missing DES encryption functions copied from Openssl 3.0 project. Incorporates a new API for performing MD4/MD5/SHA and encryption using DES-ECB mode. Unit tests are included for respective digest/encryption functions using this new API. With this change, you can pass configure --without-openssl to use the internally provided functions. If you do have openssl, then it will default to use these functions. This also provides a framework to allow other vendors to provide crypto. This closes #333, partially addresses #242 (except the pkcs11 engine support). Word has it that openssl is working on support for this, and the libp11 / opensc project are inclined not to support this. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Let ./configure control the paths for pppd This was previously done by specifying an overriding value for _ROOT_PATH. With this change, this variable is now gone. Instead, pathnames.h will use the SYSCONFDIR and LOCALSTATEDIR to resolve these paths. These directories is already controlled by configure. Package maintainers should be aware though that this may change their current configuration. The convential ./configure way is to specify: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/run --with-plugin-dir=/usr/lib/pppd/2.4.10 If one omit the --sysconfdir option, then the default location is by ${prefix}/etc which may not be what you want. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Cleanup in pppd/pppd.h, eliminate unecessary headers This removes the need to include the following heades in pppd.h <limits.h>, this is included where needed (main.c). The number of groups already retrieved is stored in the "int ngroups" variable. <sys/params.h>, use MAXPATHLEN where needed <net/if.h>, such that the value of IFNAMSIZ doesn't have to be declared to include <pppd/pppd.h> Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Changing CBCP_SUPPORT define to PPP_WITH_CBCP to be consistent. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Changing USE_TDB to PPP_WITH_TDB to be consistent. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Changing HAVE_MULTILINK to PPP_WITH_MULTILINK To be consistent with other options / defines. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Changing INET6 to PPP_WITH_IPV6CP and adding configure option Based on feedback on PR #296, the option ipv6-support seems inconsistent with the existing ipxcp option. Futhermore, the #define has been renamed to avoid bleeding into third party projects. pppdconf.h is already distributed and will define or undefine the PPP_WITH_IPV6CP define. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
pppd: Drop linux IPX support (#326) The 5.15 Linux kernel has removed ipx support, along with the userspace visible header. This support wasn't very well maintained in the kernel for several years so drop the support from ppp as well since this won't be usable in future. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Expand byte count statistics to 64 bits (#298) * Add Gigawords to radius packets where applicable. IMPORTANT NOTE: The ioctl() only supports 32-bit counters. In order t obtain 64-bit counters, these are now pulled in from sysfs (it's assumed to be mounted on /sys which I'm assuming is standard). It is unknown whether sysfs will be available everywhere, as such, keep the ioctl() method in place, but attempt to detect wrap-overs. If the sysfs mechanism fails, fail back to the ioctl(). Given maximum data rates, the intervals between calling this needs to be such that no more than 4GB (2^32) bytes are sent or received in any given interval. Mostly important for radius plugin where data accounting may be in effect. Towards this, a timer interval on 25 seconds is set to force a ioctl() poll irrespective of the rate of stats update calls. This may be important for especially radius that needs to provide interim-update intervals, if the interim updates is too long and the counters could wrap-over twice in a single interval. At 25 seconds we should detect all wraps up to an effective data rate of 1.37Gbps, which for my purposes is adequate. Possible downsides, 4 files are opened, read and closed every time statistics is requested. This results in 12 system calls every single time statistics is required, compared to 1 for the ioctl. Efficiency is unknown, but as a rule of thumb fewer system calls are better, this is however not a critical path in my opinion, so should not be a problem. If required I can run a few benchmarks using gettimeofday() to measure actual impact. Signed-off-by: Jaco Kroon <jaco@uls.co.za> * Use netlink if possible to obtain 64-bit stats. This uses two system calls per round. This should be preferred where available. It seems the RTM_GETSTATS was only added from 2016 some point (4.7.0 as per pali), which is in my opinion old, but given experience with certain embedded systems does need to be supported. Signed-off-by: Jaco Kroon <jaco@uls.co.za> Co-authored-by: Jaco Kroon <jaco@iewc.co.za>
pppd: Add ipv6-{up,down}-script options (#321) These allow a user to specify the paths to the scripts usually located at /etc/ppp/ipv6-up and /etc/ppp/ipv6-down, similarly to the existing ip-up-script and ip-down-script options Signed-off-by: Daniel Barlow <dan@telent.net>
Fixing main.c with regards to default GCC/CLANG compiler warnings This also incorporates the comments from @paulusmack. Generally, fixes: - Suppresed warnings w.r.t. unused results in signal handling and result from write() - Unused results w.r.t. setuid/getuid/chdir Signed-off-by: Eivind Næss <eivnaes@yahoo.com>