From b9b826316cd0e260fa3e2e56f934060fa77ccd05 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 24 Oct 2023 19:48:19 +0200 Subject: [PATCH] Add "ipcp-accept-remote" ppd option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PPP ≥ 2.5.0 requires this option to avoid this error: Peer refused to agree to our IP address It makes sense to let the remote decide for the remote IP address. Unfortunately, PPP < 2.5.0 does not like this option. Of course it doesn't make any sense. --- configure.ac | 11 +++++++++++ src/tunnel.c | 24 +++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index bfa843ed..5e7f021f 100644 --- a/configure.ac +++ b/configure.ac @@ -228,6 +228,10 @@ AC_ARG_WITH([pppd], with_ppp="no" ]) ) +# this is specififcally for pppd < 2.5.0 +AC_ARG_ENABLE([legacy_pppd], + AS_HELP_STRING([--enable-legacy-pppd], + [work around pppd < 2.5.0 issues])) # and this is for the ppp user space client on FreeBSD AC_ARG_WITH([ppp], AS_HELP_STRING([--with-ppp], @@ -324,6 +328,13 @@ AS_IF([test "x$with_pppd" = "xyes"], [ AC_DEFINE(HAVE_USR_SBIN_PPPD, 0) AC_MSG_NOTICE([HAVE_USR_SBIN_PPPD... 0]) ]) +AS_IF([test "x$enable_legacy_pppd" = "xyes"], [ + AC_DEFINE(LEGACY_PPPD, 1) + AC_MSG_NOTICE([LEGACY_PPPD... 1]) +],[ + AC_DEFINE(LEGACY_PPPD, 0) + AC_MSG_NOTICE([LEGACY_PPPD... 0]) +]) AS_IF([test "x$enable_proc" = "xyes"], [ AC_DEFINE(HAVE_PROC_NET_ROUTE, 1) AC_MSG_NOTICE([HAVE_PROC_NET_ROUTE... 1]) diff --git a/src/tunnel.c b/src/tunnel.c index fb877c95..3326442b 100644 --- a/src/tunnel.c +++ b/src/tunnel.c @@ -270,13 +270,31 @@ static int pppd_run(struct tunnel *tunnel) * of our local IP address, even if the local IP address * was specified in an option. * - * This option attempts to fix this: + * PPP < 2.5.0 requires this option to avoid this error: * Peer refused to agree to our IP address + * This doesn't make sense, it should be the default: + * - we do not specify a local IP address, + * - we use option noipdefault to specifically ask the + * peer to supply the local IP address. * - * Yet, this doesn't make sense: we do not specify - * a local IP address, and we use noipdefault. + * PPP ≥ 2.5.0 might not require it, but I don't dare + * removing it. */ "ipcp-accept-local", +#ifndef LEGACY_PPPD + /* + * With this option, pppd accepts the peer's idea of its + * (remote) IP address, even if the remote IP address was + * specified in an option. + * + * PPP ≥ 2.5.0 requires this option to avoid this error: + * Peer refused to agree to his IP address + * + * Unfortunately, PPP < 2.5.0 does not like this option. + * Again, this doesn't make sense. + */ + "ipcp-accept-remote", +#endif "noaccomp", "noauth", "default-asyncmap",