]> git.ozlabs.org Git - ppp.git/log
ppp.git
2 months agopppd man page: Update header to refer to pppd 2.5.x master
Paul Mackerras [Tue, 13 Feb 2024 09:40:56 +0000 (20:40 +1100)]
pppd man page: Update header to refer to pppd 2.5.x

Also remove the obsolete $Id$ tag.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2 months agopppd: Restore adding a default route with different metric (#472)
Samuel Thibault [Tue, 13 Feb 2024 09:36:08 +0000 (10:36 +0100)]
pppd: Restore adding a default route with different metric (#472)

For instance, when using a ppp link as backup link, one would want to
add a default route on the ppp link, in *addition* to the existing
default route.

d0ccb87156c2 ("pppd: Add replacedefaultroute option (#200)") however broke
this case: sifdefaultroute was not passing the metric to
defaultroute_exists any more. This commit restores this case.

Fixes #357

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 months agopppoe: Fix sending of PADT on connection termination (#470)
Paul Mackerras [Thu, 11 Jan 2024 09:38:08 +0000 (20:38 +1100)]
pppoe: Fix sending of PADT on connection termination (#470)

Commit 2b4166d02ed0 ("Close discovery socket after session completed",
2020-11-26) arranged for the discovery socket to be closed when the
PPPOE session negotiation was complete.  However, the discovery socket
is used for sending a PADT message when the connection terminates, and
now that doesn't work because the socket has been closed.

To fix this, we reopen the discovery socket in order to send the PADT
message.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
3 months agopppd: Rework use of volatile in lcp-rtt code to eliminate warnings (#469)
Paul Mackerras [Mon, 1 Jan 2024 08:24:34 +0000 (19:24 +1100)]
pppd: Rework use of volatile in lcp-rtt code to eliminate warnings (#469)

To eliminate the warnings, the lcp_rtt_buffer variable no longer
points to volatile, and instead accesses are made using 'ring_header'
local variables, which do point to volatile, and contain the same
address.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
3 months agoRemove include/net/slcompress.h
Paul Mackerras [Wed, 27 Dec 2023 15:30:07 +0000 (15:30 +0000)]
Remove include/net/slcompress.h

This is completely unused and not needed here, so remove it.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
3 months agopppd: Fix calloc calls (#416)
AtariDreams [Tue, 26 Dec 2023 18:22:23 +0000 (13:22 -0500)]
pppd: Fix calloc calls (#416)

Size and number are switched in calloc sometimes. This PR fixes that.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
Co-authored-by: Seija Kijin <doremylover123@gmail.com>
3 months agoscripts/lcp_rtt_exporter: include content length in response (#467)
Tomasz Torcz [Thu, 21 Dec 2023 19:51:57 +0000 (20:51 +0100)]
scripts/lcp_rtt_exporter: include content length in response (#467)

Signed-off-by: Tomasz Torcz <tomek@pipebreaker.pl>
3 months agoradius: Fix MPPE key decryption for the second-half of the key block (#463)
Jaco Kroon [Thu, 21 Dec 2023 19:50:58 +0000 (21:50 +0200)]
radius: Fix MPPE key decryption for the second-half of the key block (#463)

During he refactor in commit 4cb90c1 the key material used to decrypt
the second-half of the encrypted block was accidentally updated from:

MD5(radius_secret + crypt[0..15]); to:

MD5(radius_secret + crypt[0..15] + salt)

Which would obviously mismatch.

This also refactors back into what I believe to be a more readable block
with lower nesting and more comprehensive error reporting.

Closes: #453
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
3 months agoFix problem where the detection of openssl failed when pkgconfig isn't available...
Eivind Næss [Thu, 21 Dec 2023 09:29:29 +0000 (01:29 -0800)]
Fix problem where the detection of openssl failed when pkgconfig isn't available (#468)

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
4 months agopppd: constify log format strings. (#462)
Jaco Kroon [Mon, 18 Dec 2023 13:35:40 +0000 (15:35 +0200)]
pppd: constify log format strings. (#462)

Found when trying to do a simple dbglog(__FUNCTION__);

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
4 months agoci: Fix the Solaris build (#464)
Adrien RICCIARDI [Wed, 6 Dec 2023 09:26:22 +0000 (10:26 +0100)]
ci: Fix the Solaris build (#464)

Switched to the latest version of the Solaris GitHub Action that now uses Qemu
and libvirt on an Ubuntu runner instead of VirtualBox on a macOS runner.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
5 months agoFix typos in copyright dates
Paul Mackerras [Thu, 9 Nov 2023 09:02:47 +0000 (20:02 +1100)]
Fix typos in copyright dates

This fixes some typos introduced in commit d1506f182ba8, where 1994
got inadvertently changed to 1984 in three cases, and 1989 in another.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 months agoRemove <linux/if_ppp.h> and <net/if_ppp.h> headers
Paul Mackerras [Thu, 9 Nov 2023 06:20:36 +0000 (17:20 +1100)]
Remove <linux/if_ppp.h> and <net/if_ppp.h> headers

The if_ppp.h headers are redundant; all the relevant definitions are
now in ppp_defs.h, ppp-ioctl.h for Linux (which comes from the kernel
headers via the C library) and pppio.h for Solaris.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 months agoChange my paulus@samba.org email address to paulus@ozlabs.org
Paul Mackerras [Thu, 9 Nov 2023 01:19:59 +0000 (12:19 +1100)]
Change my paulus@samba.org email address to paulus@ozlabs.org

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 months agoREADME: Update for 2.5.1 release
Paul Mackerras [Thu, 9 Nov 2023 01:15:12 +0000 (12:15 +1100)]
README: Update for 2.5.1 release

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 months agopppoe: Fail if ethernet interface name is too long
Paul Mackerras [Wed, 8 Nov 2023 05:54:40 +0000 (16:54 +1100)]
pppoe: Fail if ethernet interface name is too long

If the name of the ethernet interface is longer than can fit in the
relevant structure used for system calls, generate an error rather
than using a truncated interface name.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 months agoFix for failure to detect the presence of sockaddr_ll in linux/if_packet.h (#456)
Eivind Næss [Wed, 8 Nov 2023 05:58:01 +0000 (21:58 -0800)]
Fix for failure to detect the presence of sockaddr_ll in linux/if_packet.h (#456)

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
5 months agoFix linking error with lld linkers (#438)
Brahmajit Das [Thu, 2 Nov 2023 05:56:18 +0000 (11:26 +0530)]
Fix linking error with lld linkers (#438)

When using lld linker, build fails with

ld.lld: error: /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../lib64/Scrt1.o is incompatible with elf32-i386
ld.lld: error: /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../lib64/crti.o is incompatible with elf32-i386
ld.lld: error: /usr/lib/llvm/16/bin/../../../../lib/clang/16/lib/linux

The fix is to check pkg-config first, and not force manual -L /usr/lib.
If pkg-config succeeded, then we don't bother with -L /usr/lib

Our guess is this what the actual intention was based upon the coments

if pkg-config is installed and openssl has installed a .pc file,
then use that information and don't search ssldirs

First found on gentoo linux with llvm profile, please check out Bug:
section of the commit for more info and a complete build log.

Bug: https://bugs.gentoo.org/905442

Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Co-authored-by: Sam James <sam@gentoo.org>
5 months agopppd/sys-linux: Fix compile with older Linux kernel headers (#452)
Jaco Kroon [Tue, 31 Oct 2023 09:47:21 +0000 (11:47 +0200)]
pppd/sys-linux: Fix compile with older Linux kernel headers (#452)

When compiling pppd against kernel headers which don't provide
the definitions for the NETLINK mechanisms, leave out the code
which uses NETLINK, so as to avoid getting compile errors.

Upstream commit in Linux refers.

commit 10c9ead9f3c6bb24bddc9a96681f7d58e6623966
Author: Roopa Prabhu <roopa@cumulusnetworks.com>
Date:   Wed Apr 20 08:43:43 2016 -0700
rtnetlink: add new RTM_GETSTATS message to dump link stats

This commit adds the #defines and structs used, so simply not compiling
this code if the required #defines isn't there should solve the problem.

Closes: #450
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
5 months agoplugins/radius: fix segfault during shutdown. (#455)
Jaco Kroon [Thu, 26 Oct 2023 09:52:27 +0000 (11:52 +0200)]
plugins/radius: fix segfault during shutdown. (#455)

ppp_get_ifname() is the wrong thing to use in this slprintf call as
it returns an int which is the length of the interface name, not
a pointer to the interface name, which is what ppp_ifname()
returns.

Closes: #454
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
6 months agoMerge pull request #367 from jkroonza/consolidated-ifup-down-and-scripts
Paul Mackerras [Wed, 11 Oct 2023 00:44:36 +0000 (11:44 +1100)]
Merge pull request #367 from jkroonza/consolidated-ifup-down-and-scripts

Implement net-init, net-pre-up and net-down scripts in pppd.

6 months agoMerge pull request #436 from martinetd/mkdir_runtime_lock
Paul Mackerras [Tue, 10 Oct 2023 07:13:30 +0000 (18:13 +1100)]
Merge pull request #436 from martinetd/mkdir_runtime_lock

Try to create rundir before using it

6 months agotry to create rundir if missing
Dominique Martinet [Thu, 3 Aug 2023 07:37:27 +0000 (16:37 +0900)]
try to create rundir if missing

Runtime dir changed from /run to /run/pppd in commit 66a8c74c3f73 ("Let
./configure control the paths for pppd") and is likely to not exist on
some distros, in which case the pppdb will not be created.

See: #419 (lock directory moved in ppp-2.5.0)
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
6 months agoutils: add mkdir_recursive
Dominique Martinet [Wed, 30 Aug 2023 02:46:01 +0000 (11:46 +0900)]
utils: add mkdir_recursive

This will be used in the next commit.

A test file for utils has also been added to check mkdir works as
intended.

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
6 months agoRevert lock path to /var/lock (#435)
Dominique Martinet [Tue, 10 Oct 2023 01:05:50 +0000 (10:05 +0900)]
Revert lock path to /var/lock (#435)

lock dir changed on linux from /var/lock to /run/pppd/lock with
pppd-2.5.0, which makes pppd fail to start if the distribution does not
pre-create the directory.

This reverts it back to /var/lock.

The paths for other OS should be identical as LOCALSTATEDIR should be
/var, but also revert them back as well just in case.
Since the variable is no longer used remove it from makefiles.

Fixes: 66a8c74c3f73 ("Let ./configure control the paths for pppd")
Fixes: #419
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Co-authored-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
6 months agopppd: implement net-init, net-pre-up and net-down.
Jaco Kroon [Tue, 26 Sep 2023 12:45:13 +0000 (14:45 +0200)]
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>
6 months agoMerge pull request #422 from rfc1036/lcp-rtt
Paul Mackerras [Sat, 30 Sep 2023 12:21:39 +0000 (22:21 +1000)]
Merge pull request #422 from rfc1036/lcp-rtt

Implement logging the LCP Round Trip Time

6 months agoEscape all minus characters in the man pages (#449)
Marco d'Itri [Thu, 28 Sep 2023 01:12:36 +0000 (03:12 +0200)]
Escape all minus characters in the man pages (#449)

From man-pages(7):

   Where a real minus character is required (e.g., for numbers such as -1,
   for man page cross references such as utf-8(7), or when writing options
   that  have a leading dash, such as in ls -l), use the following form in
   the man page source:

       \-

Signed-off-by: Marco d'Itri <md@linux.it>
6 months agopppoe: Fix crash when a too-long device name is given (#447)
Eivind Næss [Thu, 28 Sep 2023 01:09:51 +0000 (18:09 -0700)]
pppoe: Fix crash when a too-long device name is given (#447)

Fix for github issue #446.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
6 months agoscripts/lcp_rtt_exporter: Prometheus exporter for the LCP RTT data
Marco d'Itri [Sun, 24 Sep 2023 10:03:04 +0000 (12:03 +0200)]
scripts/lcp_rtt_exporter: Prometheus exporter for the LCP RTT data

Signed-off-by: Marco d'Itri <md@linux.it>
6 months agoscripts/lcp_rtt_dump: dump the LCP RTT log
Marco d'Itri [Sun, 7 May 2023 15:59:36 +0000 (17:59 +0200)]
scripts/lcp_rtt_dump: dump the LCP RTT log

Signed-off-by: Marco d'Itri <md@linux.it>
6 months agoimplement logging the LCP RTT
Marco d'Itri [Sun, 7 May 2023 15:56:43 +0000 (17:56 +0200)]
implement logging the LCP RTT

This change adds the lcp-rtt-file configuration option, which instructs
pppd to add a timestamp to the data section of each LCP echo request
frame and then log their round-trip time and any detected packet loss
to a circular buffer in that file.

Other programs then can asynchronously read the file and report
statistics about the line.

Signed-off-by: Marco d'Itri <md@linux.it>
7 months agoCI: Update the 'checkout' action to V3 as V2 is being deprecated. (#437)
Adrien RICCIARDI [Fri, 1 Sep 2023 11:58:46 +0000 (13:58 +0200)]
CI: Update the 'checkout' action to V3 as V2 is being deprecated. (#437)

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
7 months agopppd/options.c: fix memory leak on error path (#441)
Ilya Shipitsin [Fri, 1 Sep 2023 11:57:55 +0000 (13:57 +0200)]
pppd/options.c: fix memory leak on error path (#441)

found by Coverity

602err:
603    fclose(f);
604    privileged_option = oldpriv;
   CID 436193 (#1 of 1): Resource leak (RESOURCE_LEAK)10. overwrite_var: Overwriting option_source in option_source = oldsource leaks the storage that option_source points to.
605    option_source = oldsource;

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
8 months agopppd: Fix compilation with openssl disabled (#431)
Eivind Næss [Fri, 4 Aug 2023 06:18:09 +0000 (23:18 -0700)]
pppd: Fix compilation with openssl disabled (#431)

If openssl is disabled at configure time but microsoft extensions are enabled,
we get a compilation error due to an unnecessary include in crypto_ms.c.
This removes the unnecessary include.  With this, pppd compiles without
openssl as long as you add the following arguments to the configure script
invocation:

        --disable-peap --disable-eaptls --without-openssl

Fixes: https://github.com/ppp-project/ppp/issues/429
Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
8 months agopppd/options.c: handle malloc failure (#425)
Ilya Shipitsin [Thu, 3 Aug 2023 09:32:26 +0000 (11:32 +0200)]
pppd/options.c: handle malloc failure (#425)

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
8 months agopppd/ppp-sha1.c: use uint32_t instead of u_int32_t (#432)
bkuhls [Thu, 3 Aug 2023 09:31:23 +0000 (11:31 +0200)]
pppd/ppp-sha1.c: use uint32_t instead of u_int32_t (#432)

Fixes build with musl-libc toolchains.

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
8 months agopasswordfd: read password during option processing (#420)
Mike Gilbert [Thu, 3 Aug 2023 08:57:23 +0000 (04:57 -0400)]
passwordfd: read password during option processing (#420)

When configured to detach from the controlling terminal, pppd closes
file descriptors 0, 1, and 2 before the passwd hook is called. If the
user passes 0, 1, or 2 to the passwordfd option, pppd will fail to read
the password.

To work around this, treat passwordfd as a special option and read the
password during option processing, before pppd closes it.

Bug: https://bugs.gentoo.org/209294

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
9 months agoEnsure there is a '/' between PPP_PATH_VARRUN and the PID filename (#427)
Mike Gilbert [Mon, 26 Jun 2023 05:17:16 +0000 (01:17 -0400)]
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>
11 months agoMove pppgetpass.8 to EXTRA_DIST (#412)
Mike Gilbert [Mon, 1 May 2023 03:33:10 +0000 (23:33 -0400)]
Move pppgetpass.8 to EXTRA_DIST (#412)

automake does not seem to include noinst_*_MANS in the dist tarball.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
11 months agoMerge pull request #417 from enaess/fixes
Paul Mackerras [Mon, 1 May 2023 03:29:50 +0000 (13:29 +1000)]
Merge pull request #417 from enaess/fixes

Fixes for #411 and #413

11 months agoUpdate version to 2.5.1-dev
Paul Mackerras [Mon, 1 May 2023 02:38:28 +0000 (12:38 +1000)]
Update version to 2.5.1-dev

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
11 months agoCloses #411, Fixing up parsing in radiusclient.conf
Eivind Naess [Sun, 23 Apr 2023 18:37:01 +0000 (11:37 -0700)]
Closes #411, Fixing up parsing in radiusclient.conf

Adding curly braces to fix the code.

Signed-off-by: Eivind Naess <eivnaes@yahoo.com>
11 months agoAdd configure check to see if we have struct sockaddr_ll
Eivind Naess [Sun, 23 Apr 2023 18:30:43 +0000 (11:30 -0700)]
Add configure check to see if we have struct sockaddr_ll

Fixes issue #411.

Signed-off-by: Eivind Naess <eivnaes@yahoo.com>
13 months agoFurther updates to README for 2.5.0 release ppp-2.5.0
Paul Mackerras [Sat, 10 Dec 2022 03:26:12 +0000 (14:26 +1100)]
Further updates to README for 2.5.0 release

History from the 2.4.x series is moved to Changes-2.4.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
13 months agopppd/tty.c: Use unsigned constants for ACCM calculations
Paul Mackerras [Sat, 18 Mar 2023 08:44:13 +0000 (19:44 +1100)]
pppd/tty.c: Use unsigned constants for ACCM calculations

Use unsigned constants to avoid integer overflows when shifting, and
because xmit_accm[] is an array of unsigned values.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
13 months agoradius: Fix list traversal in rc_avpair_insert
Paul Mackerras [Sat, 18 Mar 2023 07:14:04 +0000 (18:14 +1100)]
radius: Fix list traversal in rc_avpair_insert

In rc_avpair_insert, if the list element "p" is non-NULL but not
actually in the list "a", we can end up with this_node being NULL and
being dereferenced.

By changing the while test to this_node->next we avoid having
this_node being NULL; the loop will terminate when this_node == p or
this_node->next == NULL, which is what we want.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
13 months agochat: Fix loop condition to avoid possible 1-byte buffer overrun
Paul Mackerras [Sat, 18 Mar 2023 06:34:07 +0000 (17:34 +1100)]
chat: Fix loop condition to avoid possible 1-byte buffer overrun

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
13 months agopppdump: Remove compression functions from local copy of zlib
Paul Mackerras [Sat, 18 Mar 2023 06:32:20 +0000 (17:32 +1100)]
pppdump: Remove compression functions from local copy of zlib

They aren't used (pppdump only needs decompression), and removing the
unused code avoids getting reports from automated tools about possible
errors in the unused code.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
13 months agoCI: add automatic tests, enable ASAN build&test (#399)
Ilya Shipitsin [Fri, 17 Mar 2023 23:23:43 +0000 (00:23 +0100)]
CI: add automatic tests, enable ASAN build&test (#399)

* CI: add automatic tests, enable ASAN build&test

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
13 months agoMerge pull request #409 from enaess/conf-fixes
Paul Mackerras [Fri, 17 Mar 2023 23:22:33 +0000 (10:22 +1100)]
Merge pull request #409 from enaess/conf-fixes

Additional fixes for various configure options (less frequently used) that broke

13 months agoFix compilation without ipv6cp support (#408)
Eivind Næss [Fri, 17 Mar 2023 22:52:33 +0000 (15:52 -0700)]
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>
13 months agoAdd a --with-system-ca-path <path-to-ca-directory> option to configure (#406)
Eivind Næss [Fri, 17 Mar 2023 22:50:30 +0000 (15:50 -0700)]
Add a --with-system-ca-path <path-to-ca-directory> option to configure (#406)

Allow distributions to specify a default CA path. Fix for github issue #405.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
13 months agoMerge pull request #404 from enaess/stdbool
Paul Mackerras [Fri, 17 Mar 2023 22:47:17 +0000 (09:47 +1100)]
Merge pull request #404 from enaess/stdbool

Removes autotools include guards for stdbool.h and friends

13 months agoradius plugin: add fclose operation to fix file pointer not closed after use (#401)
Bmo [Fri, 17 Mar 2023 22:20:43 +0000 (06:20 +0800)]
radius plugin: add fclose operation to fix file pointer not closed after use (#401)

Signed-off-by: Wei Xing <skyxwwalker@gmail.com>
Co-authored-by: Wei Xing <skyxwwalker@gmail.com>
13 months agoAdding 'extern "C" {' and '}' declarations to exported header files
Eivind Næss [Sat, 4 Mar 2023 05:47:11 +0000 (05:47 +0000)]
Adding 'extern "C" {' and '}' declarations to exported header files

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
13 months agoShould not require third party project to define HAVE_HEADER_H
Eivind Næss [Sat, 4 Mar 2023 03:03:16 +0000 (03:03 +0000)]
Should not require third party project to define HAVE_HEADER_H

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
13 months agoCompiling with --enable-mslanman is broken
Eivind Næss [Fri, 10 Mar 2023 00:20:03 +0000 (00:20 +0000)]
Compiling with --enable-mslanman is broken

Correcting the call to DesEncrypt() where needed.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
13 months agoAdditional fixes for broken build
Eivind Næss [Thu, 9 Mar 2023 23:59:19 +0000 (23:59 +0000)]
Additional fixes for broken build

This change fixes the build when
- ./configure is run with --disable-plugins
- ./configure is run with --disable-peap --disable-eaptls
     --disable-microsoft-extensions

The latter disables the MPPE encryption too, but <pppd/crypto.h> is
still needed.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
13 months agoFixing a few more memory leaks in chat.c
Robert Bartel [Sat, 11 Mar 2023 22:38:42 +0000 (22:38 +0000)]
Fixing a few more memory leaks in chat.c

Running Valgrind memcheck tool on chat.c while communicating with a
modem found additional memory leaks. These fixes plumb those.

Signed-off-by: Robert Bartel <r.bartel@gmx.net>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
13 months agoFixing buffer overflow issue in chat.c
Robert Bartel [Fri, 10 Mar 2023 18:31:52 +0000 (18:31 +0000)]
Fixing buffer overflow issue in chat.c

There were two issues here, the report_buffer is too small to hold the
value, and accessing the memory outside its bounds. The following fixes
was made:
- Expand the size of report_buffer to 4096 from 256, this is to account
  for handling of really long GSM USSD report strings
- Make sure to not to access memory outside the bounds of the buffer

Signed-off-by: Robert Bartel <r.bartel@gmx.net>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
13 months agoFix several issues uncovered by Coverity (#397)
Eivind Næss [Thu, 16 Mar 2023 23:13:25 +0000 (16:13 -0700)]
Fix several issues uncovered by Coverity (#397)

* Fix for coverity issue 436265, we should cap copy to size of destination buffer

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fix for coverity issue 436262, llv6_ntoa() returns a pointer to a buffer that can be up to 64 bytes long; likely not a problem, but this will quiet coverity

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fix for coverity issue 436251, not freeing path in the normal flow of the code

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fixing coverity issue #436258, Digest maybe uninitialized in some paths of this code

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fix for coverity issue 436254, forgot to free 's' before returning from the function?

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fixing coverity issue #436251, memory leak in put_string() function

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fixing coverity issue 436215, should copy at most sizeof(devname) bytes

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fixing coverity issue #436203, if no authentication (or no accounting) server was found, we still need to free the allocated local instance

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fixing coverity issue #436171, use of uninitialized variable

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Use of signed vs unsigned variable in printf for MD4Update

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fixing coverity issue #436182, fixing possible buffer overrun in handling of PW_CLASS attribute

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Fixing coverity issue #436156

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
* Compile errors

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
[paulus@ozlabs.org - Squashed to avoid breaking bisection]

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
13 months agoMerge pull request #386 from enaess/ppp-release
Paul Mackerras [Fri, 10 Mar 2023 03:35:29 +0000 (14:35 +1100)]
Merge pull request #386 from enaess/ppp-release

Few more changes before 2.5.0 release

13 months agopppd: Should check name, not ifname in ppp_set_ifname (#396)
Eivind Næss [Fri, 10 Mar 2023 01:48:49 +0000 (17:48 -0800)]
pppd: Should check name, not ifname in ppp_set_ifname (#396)

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
13 months agoFix out-of-bounds accesses to ZPasswordHash arrays (#395)
Eivind Næss [Mon, 6 Mar 2023 07:03:13 +0000 (23:03 -0800)]
Fix out-of-bounds accesses to ZPasswordHash arrays (#395)

* Add 'const' parameter to input arguments in crypto_ms.*

* Round ZPasswordHash buffers up to 24 bytes, as the DES MakeKey() function
  accesses ZPasswordHash[21]

Closes github issue #392

[paulus@ozlabs.org - tidied up headline and commit message]

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
14 months agoDisable building the plugins with static libraries (.a) files
Eivind Næss [Mon, 30 Jan 2023 16:39:15 +0000 (08:39 -0800)]
Disable building the plugins with static libraries (.a) files

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
14 months agoAdding copyright text to a few more header files.
Eivind Næss [Sat, 21 Jan 2023 22:44:16 +0000 (14:44 -0800)]
Adding copyright text to a few more header files.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
14 months agoAdd LICENSE.* for GPLv2 and BSD licenses covered by this project
Eivind Næss [Sat, 21 Jan 2023 22:34:41 +0000 (14:34 -0800)]
Add LICENSE.* for GPLv2 and BSD licenses covered by this project

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
14 months agoInitial update of README for the 2.5.0 release. Additional review + additions by...
Eivind Næss [Sat, 21 Jan 2023 22:26:09 +0000 (14:26 -0800)]
Initial update of README for the 2.5.0 release. Additional review + additions by Paul Mackerras

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
14 months agoUpdate of PLUGINS documentation
Eivind Næss [Sat, 21 Jan 2023 22:25:17 +0000 (14:25 -0800)]
Update of PLUGINS documentation

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
14 months agoHeader file reorganization and cleaning up the public API for pppd version 2.5.0...
Eivind Næss [Sat, 21 Jan 2023 06:12:58 +0000 (22:12 -0800)]
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>
15 months agoUpdate DFS's legal name and email address to correct values. (#381)
Dianne Skoll [Thu, 12 Jan 2023 03:07:58 +0000 (22:07 -0500)]
Update DFS's legal name and email address to correct values. (#381)

Signed-off-by: Dianne Skoll <dianne@skoll.ca>
15 months agofix typo (#384)
lilinjie [Thu, 12 Jan 2023 03:07:09 +0000 (03:07 +0000)]
fix typo (#384)

Signed-off-by: lilinjie <lilinjie@uniontech.com>
15 months agoMerge pull request #378 from jkroonza/radius-admin-reset
Paul Mackerras [Sat, 31 Dec 2022 06:03:15 +0000 (17:03 +1100)]
Merge pull request #378 from jkroonza/radius-admin-reset

radius: distinguish between User-Request and Admin-Reset.

16 months agoradius: distinguish between User-Request and Admin-Reset.
Jaco Kroon [Fri, 16 Dec 2022 19:09:31 +0000 (21:09 +0200)]
radius: distinguish between User-Request and Admin-Reset.

For the purposes of our definition:

User-Request - remote side hanging up.
Admin-Reset - local side hanging up.

Reasoning is that typically radius will be used to authentication
dial-in users, so if the pppd gets killed locally, that's not the User
(client) requesting hangup, but rather the local administrator (be that
a manual kill, or as a result of a CoA/Disconnect).

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
16 months agopppd: Fix spurious LCP echo failures with lcp-echo-adaptive option
Paul Mackerras [Mon, 5 Dec 2022 06:33:48 +0000 (17:33 +1100)]
pppd: Fix spurious LCP echo failures with lcp-echo-adaptive option

If the lcp-echo-adaptive option is specified, it means that seeing
received traffic on the link is considered to be an indication that
the link is working.  Hence, this resets the count of missing LCP
echo-replies to 0 when traffic is seen.  Without this, occasional
echo failures interspersed with link traffic can accumulate and end up
causing a disconnection even when the link is working correctly.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
16 months agochat: Improve signal handling
Paul Mackerras [Sat, 26 Nov 2022 07:18:03 +0000 (18:18 +1100)]
chat: Improve signal handling

This improves the way that signals are handled in chat.

First, signal handlers should not be calling functions which are not
async-signal-safe; doing so incurs the possibility of deadlock.  Thus
we can't call fatal() in signal handlers; instead we set 'fatalsig',
which functions both as a flag and as an indication of which signal
occurred, and check that at various points (basically after any
operation which might block) using the new function checksigs().

Secondly, using sigaction rather than signal() means that we can
control whether calls such as read() get restarted after a signal, and
whether the signal disposition gets reset when the signal is
delivered.  That simplifies sigalrm(); we no longer need to
re-register the handler, and we don't need the kludge of setting stdin
to non-blocking mode in order to get the read() in get_char() to
return.

This also removes a #ifdef ultrix since ultrix is no longer supported.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
18 months agoMerge pull request #370 from Chocobo1/systemd
Paul Mackerras [Sat, 8 Oct 2022 03:19:08 +0000 (14:19 +1100)]
Merge pull request #370 from Chocobo1/systemd

Fix libsystemd detection

Merged despite bogus signoff in the commits being merged, since the changes are trivial.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
18 months agoAdd `enable-systemd` flag to CI
Chocobo1 [Sun, 25 Sep 2022 08:53:43 +0000 (16:53 +0800)]
Add `enable-systemd` flag to CI

And update package indexes, otherwise apt-get might not find the package.

Signed-off-by: Chocobo1 <Chocobo1@users.noreply.github.com>
19 months agoFix libsystemd detection
Chocobo1 [Mon, 19 Sep 2022 18:25:55 +0000 (02:25 +0800)]
Fix libsystemd detection

1. Use uppercase for `prefix` parameter
   `SYSTEMD_CFLAGS` is used elsewhere so `prefix` cannot be lowercase.
   https://autotools.info/pkgconfig/pkg_check_modules.html

2. The module name should be `libsystemd`
   Previously it will result in the following compile error when building pppd/auth.c:
   > /usr/bin/ld: pppd-auth.o: undefined reference to symbol 'sd_notify@@LIBSYSTEMD_209'
   > /usr/bin/ld: /usr/lib/libsystemd.so.0: error adding symbols: DSO missing from command line

   This is due to missing `-lsystemd-daemon` flag which is provided by `libsystemd-daemon-devel`
   package on Debian or `systemd-libs` on ArchLinux. And the proper .pc file in the package is
   `libsystemd` not `systemd`.
   https://stackoverflow.com/a/38303241

Signed-off-by: Chocobo1 <Chocobo1@users.noreply.github.com>
19 months agoMerge pull request #366 from pali/rtnetlink-register
Paul Mackerras [Fri, 9 Sep 2022 02:07:20 +0000 (12:07 +1000)]
Merge pull request #366 from pali/rtnetlink-register

pppd: Retry registering interface when on rtnetlink -EBUSY error

19 months agoMerge pull request #365 from enaess/ppp-options
Paul Mackerras [Fri, 9 Sep 2022 02:06:37 +0000 (12:06 +1000)]
Merge pull request #365 from enaess/ppp-options

Add option to show all options (show-options)

19 months agoMerge pull request #362 from enaess/ppp-crypto
Paul Mackerras [Fri, 9 Sep 2022 02:05:36 +0000 (12:05 +1000)]
Merge pull request #362 from enaess/ppp-crypto

Create an new API that allows us to abstract the use of the standard crypto functions

20 months agoAdding back DesEncrypt/DesDecrypt functions as they are a special incarnation DES...
Eivind Næss [Sat, 13 Aug 2022 21:59:08 +0000 (14:59 -0700)]
Adding back DesEncrypt/DesDecrypt functions as they are a special incarnation DES w.r.t. RFC2759

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
20 months agoAdd option to show all options (show-options), and fixing up the version text to...
Eivind Næss [Mon, 15 Aug 2022 16:07:55 +0000 (09:07 -0700)]
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>
20 months agopppd: Retry registering interface when on rtnetlink -EBUSY error
Pali Rohár [Sat, 7 Aug 2021 17:48:01 +0000 (19:48 +0200)]
pppd: Retry registering interface when on rtnetlink -EBUSY error

Due to workaround in kernel module ppp_generic.ko in function
ppp_nl_newlink(), kernel may return -EBUSY error to prevent possible
mutex deadlock. In this case userspace needs to retry its request.

Proper way would be to fix kernel module to order requests and mutex
locking, so prevent deadlock in kernel and so never return this error to
userspace. Until it happens we need retry code in userspace.

Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoMerge pull request #361 from pali/rtnetlink-deduplicate
Paul Mackerras [Thu, 18 Aug 2022 23:19:14 +0000 (09:19 +1000)]
Merge pull request #361 from pali/rtnetlink-deduplicate

pppd: De-duplicate Linux rtnetlink code

20 months agoFixing up the srp compilation to work without SHA1Init() and DesEncrypt()
Eivind Næss [Wed, 10 Aug 2022 16:30:09 +0000 (09:30 -0700)]
Fixing up the srp compilation to work without SHA1Init() and DesEncrypt()

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
20 months agoReduce the clutter by defining the MD4/MD5/SHA digest lengths in one place. Avoid...
Eivind Næss [Mon, 8 Aug 2022 15:51:54 +0000 (08:51 -0700)]
Reduce the clutter by defining the MD4/MD5/SHA digest lengths in one place. Avoid using these variables in function descriptors.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
20 months agopppd: De-duplicate also rtnetlink code in get_ppp_stats_rtnetlink()
Pali Rohár [Wed, 10 Aug 2022 16:58:16 +0000 (18:58 +0200)]
pppd: De-duplicate also rtnetlink code in get_ppp_stats_rtnetlink()

Move reading of rtnelink response code from get_ppp_stats_rtnetlink() to
one common rtnetlink function rtnetlink_msg() and use it.

Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoCreate a new API to abstract the crypto functions used by pppd.
Eivind Næss [Wed, 3 Aug 2022 15:46:28 +0000 (08:46 -0700)]
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>
20 months agopppd: De-duplicate Linux rtnetlink code
Pali Rohár [Sat, 31 Jul 2021 18:50:12 +0000 (20:50 +0200)]
pppd: De-duplicate Linux rtnetlink code

Move common code for sending rtnetlink message into the new
send_rtnetlink_msg() function.

Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoMerge pull request #358 from enaess/ppp-autotools
Paul Mackerras [Tue, 9 Aug 2022 09:42:51 +0000 (19:42 +1000)]
Merge pull request #358 from enaess/ppp-autotools

PPP autotools

20 months agopppd: Fix check for incomplete ppp_stats nlmsgerr structure (#356)
pali [Tue, 9 Aug 2022 09:22:33 +0000 (11:22 +0200)]
pppd: Fix check for incomplete ppp_stats nlmsgerr structure (#356)

Response structure is incomplete when returned length is less than required
structure length.

Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agopppd: Workaround for generating ppp unit id on Linux (#355)
pali [Tue, 9 Aug 2022 09:20:15 +0000 (11:20 +0200)]
pppd: Workaround for generating ppp unit id on Linux (#355)

Linux kernel has nasty bug / feature. If PPPIOCNEWUNIT is called with
negative ppp unit id (which is default option when command line argument
"unit" is not specified; and tells kernel to choose some free ppp unit id)
and the lowest unused/free ppp unit id is present in some existing network
interface name prefixed by "ppp" string then this PPPIOCNEWUNIT ioctl
fails. In this case kernel is basically unable to create a new ppp
interface via PPPIOCNEWUNIT ioctl when user does not specify some unused
and non-conflicted unit id.

Linux kernel should be fixed to choose usable ppp unit id when was
requested via PPPIOCNEWUNIT parameter -1.

Until this happens, add a workaround for pppd to help choosing some random
ppp unit id when kernel returns this error.

Simple test case (run on system when there is no ppp interface):

    sudo ./pppd ifname ppp1 nodefaultroute noauth nolock local nodetach pty "./pppd nodefaultroute noauth nolock local nodetach notty"

Second pppd process without this patch prints into syslog following error:

    pppd 2.4.10-dev started by pali, uid 0
    Couldn't create new ppp unit: File exists
    Exit.

With this patch it falls back to random ppp unit id and succeeds:

    pppd 2.4.10-dev started by pali, uid 0
    Using interface ppp1361
    Connect: ppp1361 <--> /dev/pts/14
    ...

Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoci: Update the Solaris GitHub action to use macOS 12 instead of macOS 10.15. (#359)
Adrien RICCIARDI [Tue, 9 Aug 2022 09:17:17 +0000 (11:17 +0200)]
ci: Update the Solaris GitHub action to use macOS 12 instead of macOS 10.15. (#359)

As macOS 10.15 support will be removed soon.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
20 months agoFix warning messages on autoreconf (especially with a newer autoconf)
Eivind Næss [Sat, 30 Jul 2022 21:42:05 +0000 (14:42 -0700)]
Fix warning messages on autoreconf (especially with a newer autoconf)

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
20 months agoLet ./configure control the paths for pppd
Eivind Næss [Sat, 30 Jul 2022 21:33:15 +0000 (14:33 -0700)]
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>
20 months agopppd: Fix duplicate nameserver in resolv.conf (#337)
Vlados Korneev [Fri, 5 Aug 2022 04:18:09 +0000 (11:18 +0700)]
pppd: Fix duplicate nameserver in resolv.conf (#337)

Signed-off-by: Vlados Korneev <allaods97@gmail.com>
20 months agoMerge pull request #354 from pali/register-with-name
Paul Mackerras [Fri, 5 Aug 2022 04:10:40 +0000 (14:10 +1000)]
Merge pull request #354 from pali/register-with-name

pppd: Add support for registering ppp interface via Linux rtnetlink API