[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.
---
 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 a51f7cf..b5270f8 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -834,6 +834,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);
@@ -857,9 +858,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))
@@ -1034,6 +1037,8 @@ nm_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);
@@ -1076,7 +1081,10 @@ nm_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;
 
-- 
2.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]