[network-manager-openvpn/th/import-route-rh1350108: 2/2] properties: ignore "route 0.0.0.0" during import



commit 1656960c311e70dc71a4aeb5ed4fd1a966c5c8ff
Author: Thomas Haller <thaller redhat com>
Date:   Mon Jun 27 17:56:06 2016 +0200

    properties: ignore "route 0.0.0.0" during import
    
    The default-routes in NetworkManager are not expressed as regular routes.
    Instead you have to set never-default.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1350108

 properties/import-export.c |   10 ++++++++++
 shared/nm-default.h        |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index 62d5f74..90b4631 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -1301,6 +1301,16 @@ do_import (const char *path, const char *contents, gsize contents_len, GError **
                                }
                        }
 
+                       if (prefix == 0 && network == 0) {
+                               /* the default-route cannot be specified as normal route in NMSettingIPConfig.
+                                * Just set never-default=FALSE (which is already the default). */
+                               g_object_set (s_ip4,
+                                             NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
+                                             FALSE,
+                                             NULL);
+                               continue;
+                       }
+
                        {
 #ifdef NM_VPN_OLD
                                NMIP4Route *route;
diff --git a/shared/nm-default.h b/shared/nm-default.h
index 139dc74..1476f5d 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -77,6 +77,7 @@
 #define nm_simple_connection_new nm_connection_new
 #define NM_SETTING_IP_CONFIG NM_SETTING_IP4_CONFIG
 #define NM_SETTING_IP_CONFIG_METHOD NM_SETTING_IP4_CONFIG_METHOD
+#define NM_SETTING_IP_CONFIG_NEVER_DEFAULT NM_SETTING_IP4_CONFIG_NEVER_DEFAULT
 #define NMSettingIPConfig NMSettingIP4Config
 
 #define NMV_EDITOR_PLUGIN_ERROR                     NM_SETTING_VPN_ERROR


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