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
This commit is contained in:
Dan Williams 2017-03-21 15:38:27 -05:00 committed by Thomas Haller
parent 7d8f489933
commit 8d4570d28d

View file

@ -716,6 +716,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);
@ -739,9 +740,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))
@ -919,6 +922,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);
@ -963,7 +968,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;