From aef9e5f8b6bf1cd76afada1ed5bb1d993a09f5cb Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 21 Mar 2017 15:38:27 -0500 Subject: [PATCH] ppp: only request IPV6CP when IPv6 is enabled in the connection NM always asks pppd to run IPV6CP which will complete if the modem supports IPv6. If the user doesn't want IPv6 then NM just ignores the result. But if the host has disabled IPv6, then pppd will fail to complete the connection because pppd tries to assign the Link-Local address to the pppX interface, and if IPv6 is disabled that fails and terminates the PPP session. So only request IPV6CP when the user wants IPv6 on the connection; if they have disabled IPv6 on their host then they can simply set ipv6.method=ignore. https://mail.gnome.org/archives/networkmanager-list/2017-March/msg00047.html (cherry picked from commit 8d4570d28d1825d52de936b21d785c75b602394a) --- src/ppp/nm-ppp-manager.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c index 1bbe29d46b..d7a7fc0bba 100644 --- a/src/ppp/nm-ppp-manager.c +++ b/src/ppp/nm-ppp-manager.c @@ -715,6 +715,7 @@ create_pppd_cmd_line (NMPPPManager *self, NMSettingAdsl *adsl, const char *ppp_name, guint baud_override, + gboolean ip6_enabled, GError **err) { NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self); @@ -738,9 +739,11 @@ create_pppd_cmd_line (NMPPPManager *self, /* NM handles setting the default route */ nm_cmd_line_add_string (cmd, "nodefaultroute"); - /* Allow IPv6 to be configured by IPV6CP */ - nm_cmd_line_add_string (cmd, "ipv6"); - nm_cmd_line_add_string (cmd, ","); + if (ip6_enabled) { + /* Allow IPv6 to be configured by IPV6CP */ + nm_cmd_line_add_string (cmd, "ipv6"); + nm_cmd_line_add_string (cmd, ","); + } ppp_debug = !!getenv ("NM_PPP_DEBUG"); if (nm_logging_enabled (LOGL_DEBUG, LOGD_PPP)) @@ -918,6 +921,8 @@ _ppp_manager_start (NMPPPManager *manager, NMCmdLine *ppp_cmd; char *cmd_str; struct stat st; + const char *ip6_method; + gboolean ip6_enabled = FALSE; g_return_val_if_fail (NM_IS_PPP_MANAGER (manager), FALSE); g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE); @@ -962,7 +967,10 @@ _ppp_manager_start (NMPPPManager *manager, adsl_setting = (NMSettingAdsl *) nm_connection_get_setting (connection, NM_TYPE_SETTING_ADSL); - ppp_cmd = create_pppd_cmd_line (manager, s_ppp, pppoe_setting, adsl_setting, ppp_name, baud_override, err); + ip6_method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG); + ip6_enabled = g_strcmp0 (ip6_method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0; + + ppp_cmd = create_pppd_cmd_line (manager, s_ppp, pppoe_setting, adsl_setting, ppp_name, baud_override, ip6_enabled, err); if (!ppp_cmd) goto out;