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>
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>
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>
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>
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>
Change my paulus@samba.org email address to paulus@ozlabs.org Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
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>
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>
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>
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>
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>
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>
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>
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>