**My first patch to NM, need some help for test cases**

Use NM_SETTING_IP6_CONFIG_METHOD_DISABLED/"disabled" for disabling
IPv6 per profile.

Signed-off-by: Gris Ge <f...@redhat.com>
---
 clients/common/nm-meta-setting-desc.c         |  3 +-
 clients/common/nm-vpn-helpers.c               |  2 +-
 clients/common/settings-docs.h.in             |  2 +-
 clients/tui/nmt-page-ip6.c                    |  1 +
 libnm-core/nm-connection.c                    | 63 +++++++++++--------
 libnm-core/nm-setting-ip-config.c             |  6 +-
 libnm-core/nm-setting-ip6-config.c            | 10 +++
 libnm-core/nm-setting-ip6-config.h            |  8 +++
 src/NetworkManagerUtils.c                     |  9 ++-
 src/devices/nm-device.c                       | 17 +++--
 src/devices/wwan/nm-modem.c                   |  8 ++-
 src/initrd/nmi-cmdline-reader.c               |  2 +-
 src/initrd/nmi-ibft-reader.c                  |  2 +-
 .../plugins/ifcfg-rh/nms-ifcfg-rh-reader.c    |  5 +-
 .../plugins/ifcfg-rh/nms-ifcfg-rh-writer.c    |  3 +-
 15 files changed, 95 insertions(+), 46 deletions(-)

diff --git a/clients/common/nm-meta-setting-desc.c 
b/clients/common/nm-meta-setting-desc.c
index 98cb50405..209146f15 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -5734,7 +5734,8 @@ static const NMMetaPropertyInfo *const 
property_infos_IP6_CONFIG[] = {
                                                                  
NM_SETTING_IP6_CONFIG_METHOD_DHCP,
                                                                  
NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
                                                                  
NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
-                                                                 
NM_SETTING_IP6_CONFIG_METHOD_SHARED),
+                                                                 
NM_SETTING_IP6_CONFIG_METHOD_SHARED,
+                                                                 
NM_SETTING_IP6_CONFIG_METHOD_DISABLED),
                ),
        ),
        PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS, 
DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS,
diff --git a/clients/common/nm-vpn-helpers.c b/clients/common/nm-vpn-helpers.c
index 081d60561..c06dcb4ee 100644
--- a/clients/common/nm-vpn-helpers.c
+++ b/clients/common/nm-vpn-helpers.c
@@ -737,7 +737,7 @@ fail_invalid_secret:
        }
 
        for (is_v4 = 0; is_v4 < 2; is_v4++) {
-               const char *method_disabled = is_v4 ? 
NM_SETTING_IP4_CONFIG_METHOD_DISABLED : NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
+               const char *method_disabled = is_v4 ? 
NM_SETTING_IP4_CONFIG_METHOD_DISABLED : NM_SETTING_IP6_CONFIG_METHOD_DISABLED;
                const char *method_manual   = is_v4 ? 
NM_SETTING_IP4_CONFIG_METHOD_MANUAL   : NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
                NMSettingIPConfig *s_ip     = is_v4 ? s_ip4                     
            : s_ip6;
                GPtrArray *data_dns         = is_v4 ? data_dns_v4               
            : data_dns_v6;
diff --git a/clients/common/settings-docs.h.in 
b/clients/common/settings-docs.h.in
index 811f2f16d..e3df4f117 100644
--- a/clients/common/settings-docs.h.in
+++ b/clients/common/settings-docs.h.in
@@ -214,7 +214,7 @@
 #define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS N_("When \"method\" 
is set to \"auto\" and this property to TRUE, automatically configured 
nameservers and search domains are ignored and only nameservers and search 
domains specified in the \"dns\" and \"dns-search\" properties, if any, are 
used.")
 #define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES N_("When 
\"method\" is set to \"auto\" and this property to TRUE, automatically 
configured routes are ignored and only routes specified in the \"routes\" 
property, if any, are used.")
 #define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_MAY_FAIL N_("If TRUE, allow overall 
network configuration to proceed even if the configuration specified by this 
property times out.  Note that at least one IP configuration must succeed or 
overall network configuration will still fail.  For example, in IPv6-only 
networks, setting this property to TRUE on the NMSettingIP4Config allows the 
overall network configuration to succeed if IPv4 configuration fails but IPv6 
configuration completes successfully.")
-#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_METHOD N_("IP configuration method. 
NMSettingIP4Config and NMSettingIP6Config both support \"auto\", \"manual\", 
and \"link-local\". See the subclass-specific documentation for other values. 
In general, for the \"auto\" method, properties such as \"dns\" and \"routes\" 
specify information that is added on to the information returned from automatic 
configuration.  The \"ignore-auto-routes\" and \"ignore-auto-dns\" properties 
modify this behavior. For methods that imply no upstream network, such as 
\"shared\" or \"link-local\", these properties must be empty. For IPv4 method 
\"shared\", the IP subnet can be configured by adding one manual IPv4 address 
or otherwise 10.42.x.0/24 is chosen. Note that the shared method must be 
configured on the interface which shares the internet to a subnet, not on the 
uplink which is shared.")
+#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_METHOD N_("IP configuration method. 
NMSettingIP4Config and NMSettingIP6Config both support \"disabled\", \"auto\", 
\"manual\", and \"link-local\". See the subclass-specific documentation for 
other values. In general, for the \"auto\" method, properties such as \"dns\" 
and \"routes\" specify information that is added on to the information returned 
from automatic configuration.  The \"ignore-auto-routes\" and 
\"ignore-auto-dns\" properties modify this behavior. For methods that imply no 
upstream network, such as \"shared\" or \"link-local\", these properties must 
be empty. For IPv4 method \"shared\", the IP subnet can be configured by adding 
one manual IPv4 address or otherwise 10.42.x.0/24 is chosen. Note that the 
shared method must be configured on the interface which shares the internet to 
a subnet, not on the uplink which is shared.")
 #define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NEVER_DEFAULT N_("If TRUE, this 
connection will never be the default connection for this IP type, meaning it 
will never be assigned the default route by NetworkManager.")
 #define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_METRIC N_("The default metric 
for routes that don't explicitly specify a metric. The default value -1 means 
that the metric is chosen automatically based on the device type. The metric 
applies to dynamic routes, manual (static) routes that don't have an explicit 
metric setting, address prefix routes, and the default route. Note that for 
IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, 
setting this property to zero effectively mean setting it to 1024. For IPv4, 
zero is a regular value for the metric.")
 #define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_TABLE N_("Enable policy 
routing (source routing) and set the routing table used when adding routes. 
This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, 
default-routes and static routes. But note that static routes can individually 
overwrite the setting by explicitly specifying a non-zero routing table. If the 
table setting is left at zero, it is eligible to be overwritten via global 
configuration. If the property is zero even after applying the global 
configuration value, policy routing is disabled for the address family of this 
connection. Policy routing disabled means that NetworkManager will add all 
routes to the main table (except static routes that explicitly configure a 
different table). Additionally, NetworkManager will not delete any extraneous 
routes from tables except the main table. This is to preserve backward 
compatibility for users who manage routing tables outside of NetworkManager.")
diff --git a/clients/tui/nmt-page-ip6.c b/clients/tui/nmt-page-ip6.c
index 2444a93d7..661001bf2 100644
--- a/clients/tui/nmt-page-ip6.c
+++ b/clients/tui/nmt-page-ip6.c
@@ -40,6 +40,7 @@ static NmtNewtPopupEntry ip6methods[] = {
        { N_("Automatic (DHCP-only)"), NM_SETTING_IP6_CONFIG_METHOD_DHCP },
        { N_("Link-Local"), NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL },
        { N_("Manual"), NM_SETTING_IP6_CONFIG_METHOD_MANUAL },
+       { N_("Disabled"), NM_SETTING_IP6_CONFIG_METHOD_DISABLED},
        { NULL, NULL }
 };
 
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index cf06f1b0f..ae72ee4fd 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -1001,35 +1001,48 @@ _normalize_ip_config (NMConnection *self, GHashTable 
*parameters)
                        nm_connection_add_setting (self, setting);
                        changed = TRUE;
                } else {
-                       const char *token;
-
-                       token = nm_setting_ip6_config_get_token 
((NMSettingIP6Config *) s_ip6);
-                       if (   token
-                           && nm_setting_ip6_config_get_addr_gen_mode 
((NMSettingIP6Config *) s_ip6) == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64) {
-                               struct in6_addr i6_token;
-                               char normalized[NM_UTILS_INET_ADDRSTRLEN];
-
-                               if (   inet_pton (AF_INET6, token, &i6_token) 
== 1
-                                   && _nm_utils_inet6_is_token (&i6_token)) {
-                                       nm_utils_inet6_ntop (&i6_token, 
normalized);
-                                       if (g_strcmp0 (token, normalized)) {
-                                               g_object_set (s_ip6, 
NM_SETTING_IP6_CONFIG_TOKEN, normalized, NULL);
-                                               changed = TRUE;
+                       /* If IPv6 is disabled, clear other config */
+                       if ( nm_streq0 (nm_setting_ip_config_get_method (s_ip6),
+                                       NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) 
{
+                               setting = nm_setting_ip6_config_new ();
+
+                               g_object_set (setting,
+                                             NM_SETTING_IP_CONFIG_METHOD,
+                                             
NM_SETTING_IP6_CONFIG_METHOD_DISABLED,
+                                             NULL);
+                               nm_connection_add_setting (self, setting);
+                               changed = TRUE;
+                       } else {
+                               const char *token;
+
+                               token = nm_setting_ip6_config_get_token 
((NMSettingIP6Config *) s_ip6);
+                               if (   token
+                                   && nm_setting_ip6_config_get_addr_gen_mode 
((NMSettingIP6Config *) s_ip6) == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64) {
+                                       struct in6_addr i6_token;
+                                       char 
normalized[NM_UTILS_INET_ADDRSTRLEN];
+
+                                       if (   inet_pton (AF_INET6, token, 
&i6_token) == 1
+                                           && _nm_utils_inet6_is_token 
(&i6_token)) {
+                                               nm_utils_inet6_ntop (&i6_token, 
normalized);
+                                               if (g_strcmp0 (token, 
normalized)) {
+                                                       g_object_set (s_ip6, 
NM_SETTING_IP6_CONFIG_TOKEN, normalized, NULL);
+                                                       changed = TRUE;
+                                               }
                                        }
                                }
-                       }
 
-                       if (   nm_setting_ip_config_get_gateway (s_ip6)
-                           && nm_setting_ip_config_get_never_default (s_ip6)) {
-                               g_object_set (s_ip6, 
NM_SETTING_IP_CONFIG_GATEWAY, NULL, NULL);
-                               changed = TRUE;
-                       }
+                               if (   nm_setting_ip_config_get_gateway (s_ip6)
+                                   && nm_setting_ip_config_get_never_default 
(s_ip6)) {
+                                       g_object_set (s_ip6, 
NM_SETTING_IP_CONFIG_GATEWAY, NULL, NULL);
+                                       changed = TRUE;
+                               }
 
-                       if (   nm_streq0 (nm_setting_ip_config_get_method 
(s_ip6),
-                                         NM_SETTING_IP6_CONFIG_METHOD_IGNORE)
-                           && !nm_setting_ip_config_get_may_fail (s_ip6)) {
-                               g_object_set (s_ip6, 
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL);
-                               changed = TRUE;
+                               if (   nm_streq0 
(nm_setting_ip_config_get_method (s_ip6),
+                                                 
NM_SETTING_IP6_CONFIG_METHOD_IGNORE)
+                                   && !nm_setting_ip_config_get_may_fail 
(s_ip6)) {
+                                       g_object_set (s_ip6, 
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL);
+                                       changed = TRUE;
+                               }
                        }
                }
        } else {
diff --git a/libnm-core/nm-setting-ip-config.c 
b/libnm-core/nm-setting-ip-config.c
index 1003994f1..8802ce50a 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -5381,9 +5381,9 @@ nm_setting_ip_config_class_init (NMSettingIPConfigClass 
*klass)
         *
         * IP configuration method.
         *
-        * #NMSettingIP4Config and #NMSettingIP6Config both support "auto",
-        * "manual", and "link-local". See the subclass-specific documentation 
for
-        * other values.
+        * #NMSettingIP4Config and #NMSettingIP6Config both support "disabled",
+        * "auto", "manual", and "link-local". See the subclass-specific
+        * documentation for other values.
         *
         * In general, for the "auto" method, properties such as
         * #NMSettingIPConfig:dns and #NMSettingIPConfig:routes specify 
information
diff --git a/libnm-core/nm-setting-ip6-config.c 
b/libnm-core/nm-setting-ip6-config.c
index f9b447a68..d6d28e5cf 100644
--- a/libnm-core/nm-setting-ip6-config.c
+++ b/libnm-core/nm-setting-ip6-config.c
@@ -176,6 +176,16 @@ verify (NMSetting *setting, NMConnection *connection, 
GError **error)
                        g_prefix_error (error, "%s.%s: ", 
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES);
                        return FALSE;
                }
+       } else if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) {
+               if (nm_setting_ip_config_get_num_addresses (s_ip) != 0) {
+                       g_set_error (error,
+                                    NM_CONNECTION_ERROR,
+                                    NM_CONNECTION_ERROR_MISSING_PROPERTY,
+                                    _("this property cannot be set for 
'%s=%s'"),
+                                    NM_SETTING_IP_CONFIG_METHOD, method);
+                       g_prefix_error (error, "%s.%s: ", 
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES);
+                       return FALSE;
+               }
        } else if (   !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)
                   || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)
                   || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) {
diff --git a/libnm-core/nm-setting-ip6-config.h 
b/libnm-core/nm-setting-ip6-config.h
index ae8ab1a23..7b580eee5 100644
--- a/libnm-core/nm-setting-ip6-config.h
+++ b/libnm-core/nm-setting-ip6-config.h
@@ -101,6 +101,14 @@ G_BEGIN_DECLS
  */
 #define NM_SETTING_IP6_CONFIG_METHOD_SHARED     "shared"
 
+/**
+ * NM_SETTING_IP6_CONFIG_METHOD_DISABLED:
+ *
+ * This connection does not use or require IPv6 address and it should be
+ * disabled.
+ */
+#define NM_SETTING_IP6_CONFIG_METHOD_DISABLED   "disabled"
+
 /**
  * NMSettingIP6ConfigPrivacy:
  * @NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN: unknown or no value specified
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
index 13cb1daed..33be2dd09 100644
--- a/src/NetworkManagerUtils.c
+++ b/src/NetworkManagerUtils.c
@@ -229,6 +229,7 @@ nm_utils_connection_has_default_route (NMConnection 
*connection,
                        goto out;
        } else {
                if (NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+                                         NM_SETTING_IP6_CONFIG_METHOD_DISABLED,
                                          
NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL))
                        goto out;
        }
@@ -343,6 +344,9 @@ check_ip6_method (NMConnection *orig,
        candidate_ip6_method = nm_utils_get_ip_config_method (candidate, 
AF_INET6);
        candidate_ip6 = nm_connection_get_setting_ip6_config (candidate);
 
+       if (nm_streq(candidate_ip6_method, 
NM_SETTING_IP6_CONFIG_METHOD_DISABLED))
+               return TRUE;
+
        if (   nm_streq (orig_ip6_method, 
NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)
            && nm_streq (candidate_ip6_method, 
NM_SETTING_IP6_CONFIG_METHOD_AUTO)
            && (   !candidate_ip6
@@ -356,9 +360,10 @@ check_ip6_method (NMConnection *orig,
                allow = TRUE;
        } else if (   NM_IN_STRSET (orig_ip6_method, 
NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
                                                     
NM_SETTING_IP6_CONFIG_METHOD_AUTO)
-                  && nm_streq0 (candidate_ip6_method, 
NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
+                  && NM_IN_STRSET (candidate_ip6_method, 
NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+                                                         
NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) {
                /* If the generated connection method is 'link-local' or 'auto' 
and the candidate
-                * method is 'ignore' we can take the connection, because NM 
didn't simply take care
+                * method is 'ignore' or 'disabled' we can take the connection, 
because NM didn't simply take care
                 * of IPv6.
                 */
                allow = TRUE;
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 1a9a8a374..111257491 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -4941,7 +4941,7 @@ static void
 check_ip_state (NMDevice *self, gboolean may_fail, gboolean full_state_update)
 {
        NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
-       gboolean ip4_disabled = FALSE, ip6_ignore = FALSE;
+       gboolean ip4_disabled = FALSE, ip6_ignore = FALSE, ip6_disabled = FALSE;
        NMSettingIPConfig *s_ip4, *s_ip6;
        NMDeviceState state;
 
@@ -4965,6 +4965,10 @@ check_ip_state (NMDevice *self, gboolean may_fail, 
gboolean full_state_update)
                                NM_SETTING_IP6_CONFIG_METHOD_IGNORE))
                ip6_ignore = TRUE;
 
+       if (s_ip6 && nm_streq0 (nm_setting_ip_config_get_method (s_ip6),
+                               NM_SETTING_IP6_CONFIG_METHOD_DISABLED))
+               ip6_disabled = TRUE;
+
        if (   priv->ip_state_4 == NM_DEVICE_IP_STATE_DONE
            && priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE) {
                /* Both method completed (or disabled), proceed with activation 
*/
@@ -4973,7 +4977,7 @@ check_ip_state (NMDevice *self, gboolean may_fail, 
gboolean full_state_update)
        }
 
        if (   (priv->ip_state_4 == NM_DEVICE_IP_STATE_FAIL || (ip4_disabled && 
priv->ip_state_4 == NM_DEVICE_IP_STATE_DONE))
-           && (priv->ip_state_6 == NM_DEVICE_IP_STATE_FAIL || (ip6_ignore && 
priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE))) {
+           && (priv->ip_state_6 == NM_DEVICE_IP_STATE_FAIL || ((ip6_ignore || 
ip6_disabled)  && priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE))) {
                /* Either both methods failed, or only one failed and the other 
is
                 * disabled */
                if (nm_device_sys_iface_state_is_external_or_assume (self)) {
@@ -5010,7 +5014,7 @@ check_ip_state (NMDevice *self, gboolean may_fail, 
gboolean full_state_update)
 
        /* If at least a method has completed, proceed with activation */
        if (   (priv->ip_state_4 == NM_DEVICE_IP_STATE_DONE && !ip4_disabled)
-           || (priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE && !ip6_ignore)) {
+           || (priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE && !(ip6_ignore || 
ip6_disabled))) {
                if (full_state_update)
                        nm_device_state_changed (self, 
NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
                return;
@@ -9836,8 +9840,11 @@ act_stage3_ip_config_start (NMDevice *self,
        } else {
                NMSettingIP6ConfigPrivacy ip6_privacy = 
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN;
                const char *ip6_privacy_str = "0";
-
-               if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
+               if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) {
+                       nm_device_sysctl_ip_conf_set (self, AF_INET6,
+                                                     "disable_ipv6", "1");
+                       return NM_ACT_STAGE_RETURN_IP_DONE;
+               } else if (nm_streq (method, 
NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
                        if (   !priv->master
                            && !nm_device_sys_iface_state_is_external (self)) {
                                gboolean ipv6ll_handle_old = 
priv->ipv6ll_handle;
diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c
index 177942295..ca4dc5de2 100644
--- a/src/devices/wwan/nm-modem.c
+++ b/src/devices/wwan/nm-modem.c
@@ -344,7 +344,8 @@ nm_modem_get_connection_ip_type (NMModem *self,
        s_ip6 = nm_connection_get_setting_ip6_config (connection);
        if (s_ip6) {
                method = nm_setting_ip_config_get_method (s_ip6);
-               if (g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 
0)
+               if (NM_IN_STRSET(method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+                                        NM_SETTING_IP6_CONFIG_METHOD_DISABLED))
                        ip6 = FALSE;
                ip6_may_fail = nm_setting_ip_config_get_may_fail (s_ip6);
        }
@@ -824,8 +825,9 @@ nm_modem_stage3_ip6_config_start (NMModem *self,
 
        method = nm_utils_get_ip_config_method (connection, AF_INET6);
 
-       /* Only Ignore and Auto methods make sense for WWAN */
-       if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE))
+       /* Only Ignore, Disabled and Auto methods make sense for WWAN */
+       if (NM_IN_STRSET(method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+                                NM_SETTING_IP4_CONFIG_METHOD_DISABLED))
                return NM_ACT_STAGE_RETURN_IP_DONE;
 
        if (!nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) {
diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c
index b9c75c1ba..79e2c3be2 100644
--- a/src/initrd/nmi-cmdline-reader.c
+++ b/src/initrd/nmi-cmdline-reader.c
@@ -332,7 +332,7 @@ parse_ip (GHashTable *connections, const char *sysfs_dir, 
char *argument)
        if (g_strcmp0 (kind, "none") == 0 || (g_strcmp0 (kind, "off") == 0)) {
                if (nm_setting_ip_config_get_num_addresses (s_ip6) == 0) {
                        g_object_set (s_ip6,
-                                     NM_SETTING_IP_CONFIG_METHOD, 
NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+                                     NM_SETTING_IP_CONFIG_METHOD, 
NM_SETTING_IP6_CONFIG_METHOD_DISABLED,
                                      NULL);
                }
                if (nm_setting_ip_config_get_num_addresses (s_ip4) == 0) {
diff --git a/src/initrd/nmi-ibft-reader.c b/src/initrd/nmi-ibft-reader.c
index efac53076..2db38e2c7 100644
--- a/src/initrd/nmi-ibft-reader.c
+++ b/src/initrd/nmi-ibft-reader.c
@@ -182,7 +182,7 @@ ip_setting_add_from_block (GHashTable *nic,
        case AF_INET:
                s_ip = s_ip4;
                g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD,
-                             NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL);
+                             NM_SETTING_IP6_CONFIG_METHOD_DISABLED, NULL);
                break;
        case AF_INET6:
                s_ip = s_ip6;
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c 
b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index 286ee58ab..e91a2a3b5 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -1973,7 +1973,7 @@ make_ip6_setting (shvarFile *ifcfg,
        }
 
        if (!ipv6init)
-               method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE;  /* IPv6 is 
disabled */
+               method = NM_SETTING_IP6_CONFIG_METHOD_DISABLED;  /* IPv6 is 
disabled */
        else {
                ipv6forwarding = svGetValueBoolean (ifcfg, "IPV6FORWARDING", 
FALSE);
                nm_clear_g_free (&value);
@@ -2039,7 +2039,8 @@ make_ip6_setting (shvarFile *ifcfg,
                      NULL);
 
        /* Don't bother to read IP, DNS and routes when IPv6 is disabled */
-       if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0)
+       if (NM_IN_STRSET(method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+                                NM_SETTING_IP6_CONFIG_METHOD_DISABLED))
                return NM_SETTING (g_steal_pointer (&s_ip6));
 
        nm_clear_g_free (&value);
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c 
b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
index e9a023c5b..0d24c300f 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
@@ -2805,7 +2805,8 @@ write_ip6_setting (NMConnection *connection,
 
        value = nm_setting_ip_config_get_method (s_ip6);
        g_assert (value);
-       if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
+       if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) ||
+           !strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) {
                svSetValueStr (ifcfg, "IPV6INIT", "no");
                svUnsetValue (ifcfg, "DHCPV6C");
                return TRUE;
-- 
2.21.0

_______________________________________________
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to