From fe2aade56531991870832e2c83b8ccd9be17e221 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 7 Jun 2023 08:51:54 +0200 Subject: [PATCH] ppp: fix plugin name for "rp-pppoe.so" with ppp 2.5 Between ppp 2.4.8 and 2.4.9, "rp-pppoe.so" was renamed to "pppoe.so" (and a symlink created). Between 2.4.9 and 2.5.0, the symlink was dropped. See-also: https://github.com/ppp-project/ppp/commit/b2c36e6c0e1655aea9b1b0a03a8160f42a26c884 I guess, NetworkManager always meant to use ppp's "(rp-)pppoe.so" plugin, and never what rp-pppoe provides. If a user actually wants to use the plugin from rp-pppoe project, then this is going to break. But it seams, we usually intend to use the plugin from the ppp project. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1312 Fixes: afe80171b24d ('ppp: move ppp code to "nm-pppd-compat.c"') --- src/core/ppp/nm-ppp-manager.c | 5 +++-- src/core/ppp/nm-pppd-compat.c | 8 ++++++++ src/core/ppp/nm-pppd-compat.h | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/ppp/nm-ppp-manager.c b/src/core/ppp/nm-ppp-manager.c index bb043a7e41..58364c384d 100644 --- a/src/core/ppp/nm-ppp-manager.c +++ b/src/core/ppp/nm-ppp-manager.c @@ -38,6 +38,7 @@ #include "nm-pppd-plugin.h" #include "nm-ppp-plugin-api.h" #include "nm-ppp-status.h" +#include "nm-pppd-compat.h" #define NM_PPPD_PLUGIN PPPD_PLUGIN_DIR "/nm-pppd-plugin.so" @@ -843,7 +844,7 @@ create_pppd_cmd_line(NMPPPManager *self, const char *pppoe_service; nm_strv_ptrarray_add_string_dup(cmd, "plugin"); - nm_strv_ptrarray_add_string_dup(cmd, "rp-pppoe.so"); + nm_strv_ptrarray_add_string_dup(cmd, nm_pppd_compat_get_pppoe_plugin_name()); nm_strv_ptrarray_add_string_concat(cmd, "nic-", priv->parent_iface); @@ -872,7 +873,7 @@ create_pppd_cmd_line(NMPPPManager *self, } else if (!strcmp(protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE)) { nm_strv_ptrarray_add_string_dup(cmd, "plugin"); - nm_strv_ptrarray_add_string_dup(cmd, "rp-pppoe.so"); + nm_strv_ptrarray_add_string_dup(cmd, nm_pppd_compat_get_pppoe_plugin_name()); nm_strv_ptrarray_add_string_dup(cmd, priv->parent_iface); } diff --git a/src/core/ppp/nm-pppd-compat.c b/src/core/ppp/nm-pppd-compat.c index fd67eb3493..81b69f4663 100644 --- a/src/core/ppp/nm-pppd-compat.c +++ b/src/core/ppp/nm-pppd-compat.c @@ -94,6 +94,14 @@ G_STATIC_ASSERT(NM_PPPD_COMPAT_MAXSECRETLEN == MAXSECRETLEN); /*****************************************************************************/ +_nm_const const char * +nm_pppd_compat_get_pppoe_plugin_name(void) +{ + return PPP_VERSION_2_5_OR_NEWER ? "pppoe.so" : "rp-pppoe.so"; +} + +/*****************************************************************************/ + int nm_pppd_compat_get_ifunit(void) { diff --git a/src/core/ppp/nm-pppd-compat.h b/src/core/ppp/nm-pppd-compat.h index 11376e360e..1edffdfa98 100644 --- a/src/core/ppp/nm-pppd-compat.h +++ b/src/core/ppp/nm-pppd-compat.h @@ -11,6 +11,8 @@ int nm_pppd_compat_get_ifunit(void); +const char *nm_pppd_compat_get_pppoe_plugin_name(void) _nm_const; + const char *nm_pppd_compat_get_ifname(void); void nm_pppd_compat_set_ifname(const char *ifname);