[network-manager-openvpn/th/export-bgo764132: 18/23] properties: refactor do_export() (refactor writing "proto")



commit fcc031eac93aa87046a16c69dd573a3daea03fe1
Author: Thomas Haller <thaller redhat com>
Date:   Thu Mar 24 11:34:07 2016 +0100

    properties: refactor do_export() (refactor writing "proto")

 properties/import-export.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index 07ae1e7..e5e16a2 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -1648,7 +1648,6 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
        const char *connection_type;
        const char *local_ip = NULL;
        const char *remote_ip = NULL;
-       gboolean proto_udp = TRUE;
        gboolean use_lzo = FALSE;
        gboolean use_float = FALSE;
        gboolean keysize_exists = FALSE;
@@ -1696,10 +1695,6 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
        connection_type = _arg_is_set (nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE));
 
        /* Advanced values start */
-       value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP);
-       if (value && !strcmp (value, "yes"))
-               proto_udp = FALSE;
-
        value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO);
        if (value && !strcmp (value, "yes"))
                use_lzo = TRUE;
@@ -1864,7 +1859,10 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
                        args_write_line (f, "dev-type", device_type);
        }
 
-       args_write_line (f, "proto", proto_udp ? "udp" : "tcp");
+       args_write_line (f,
+                        "proto",
+                        nm_streq0 (nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP), "yes")
+                            ? "tcp" : "udp");
 
        args_write_line_setting_value (f, "port", s_vpn, NM_OPENVPN_KEY_PORT);
 


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