=?UTF-8?B?UmU6IFtQQVRDSF0gbXVsdGlwbGUgcmVtb3RlcyBhbmQgcmVtb3RlLXJhbmRv?= =?UTF-8?B?bSBpbiBvcGVudnBu?=
- From: 4garbage <4garbage mail ru>
- To: Dan Williams <dcbw redhat com>
- Cc: networkmanager-list gnome org
- Subject: Re: [PATCH] multiple remotes and remote-random in openvpn
- Date: Fri, 23 Mar 2012 01:10:23 +0400
sensible advice, i've just moved checkbox into openvpn-advanced-dialog
22.03.2012, 20:28, "Dan Williams" <dcbw redhat com>:
> On Fri, 2012-03-16 at 03:51 +0400, 4garbage wrote:
>
>> Hello!
>> I've made a patch to support subj. in NM. Multiple hosts just
>> separated by commas and/or spaces in gateway_entry. I think it's still
>> suitable for including into the project, though may be the "NM way" is
>> to use GtkTree and other forms for each new host.
>
> Looks like a nice feature to have; though I wonder if the random remote
> checkbox shouldn't be in the Advanced... dialog.
>
> Dan
diff -ur NetworkManager-openvpn-0.9.3.995.orig/po/ru.po NetworkManager-openvpn-0.9.3.995/po/ru.po
--- NetworkManager-openvpn-0.9.3.995.orig/po/ru.po 2012-02-11 02:30:14.000000000 +0400
+++ NetworkManager-openvpn-0.9.3.995/po/ru.po 2012-03-23 00:49:34.772274098 +0400
@@ -356,6 +356,9 @@
msgid "_Gateway:"
msgstr "_Шлюз:"
+msgid "_Randomize remote hosts"
+msgstr "_Случайный шлюз"
+
#: ../src/nm-openvpn-service.c:192
#, c-format
msgid "invalid address '%s'"
diff -ur NetworkManager-openvpn-0.9.3.995.orig/properties/nm-openvpn.c NetworkManager-openvpn-0.9.3.995/properties/nm-openvpn.c
--- NetworkManager-openvpn-0.9.3.995.orig/properties/nm-openvpn.c 2012-02-11 02:30:14.000000000 +0400
+++ NetworkManager-openvpn-0.9.3.995/properties/nm-openvpn.c 2012-03-23 00:49:34.773274091 +0400
@@ -290,6 +290,15 @@
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "remoterandom_checkbutton"));
+ g_return_val_if_fail (widget != NULL, FALSE);
+ if (s_vpn) {
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE_RANDOM);
+ if (value && !strcmp (value, "yes"))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ }
+ g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (stuff_changed_cb), self);
+
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "auth_combo"));
g_return_val_if_fail (widget != NULL, FALSE);
gtk_size_group_add_widget (priv->group, widget);
@@ -435,6 +444,11 @@
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE, str);
+ /* Remote random */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "remoterandom_checkbutton"));
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE_RANDOM, g_strdup ("yes"));
+
auth_type = get_auth_type (priv->builder);
if (auth_type) {
nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, auth_type);
diff -ur NetworkManager-openvpn-0.9.3.995.orig/properties/nm-openvpn-dialog.ui NetworkManager-openvpn-0.9.3.995/properties/nm-openvpn-dialog.ui
--- NetworkManager-openvpn-0.9.3.995.orig/properties/nm-openvpn-dialog.ui 2012-02-11 02:30:14.000000000 +0400
+++ NetworkManager-openvpn-0.9.3.995/properties/nm-openvpn-dialog.ui 2012-03-23 00:49:45.415205769 +0400
@@ -414,6 +414,23 @@
<property name="position">7</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remoterandom_checkbutton">
+ <property name="label" translatable="yes">Randomi_ze remote hosts</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="tooltip_text" translatable="yes">Randomize the order of the list as a kind of basic load-balancing measure. config: remote-random</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">8</property>
+ </packing>
+ </child>
</object>
</child>
<child type="tab">
diff -ur NetworkManager-openvpn-0.9.3.995.orig/src/nm-openvpn-service.c NetworkManager-openvpn-0.9.3.995/src/nm-openvpn-service.c
--- NetworkManager-openvpn-0.9.3.995.orig/src/nm-openvpn-service.c 2012-02-11 02:30:14.000000000 +0400
+++ NetworkManager-openvpn-0.9.3.995/src/nm-openvpn-service.c 2012-03-23 00:49:34.777274066 +0400
@@ -111,6 +111,7 @@
{ NM_OPENVPN_KEY_PROXY_RETRY, G_TYPE_BOOLEAN, 0, 0, FALSE },
{ NM_OPENVPN_KEY_HTTP_PROXY_USERNAME, G_TYPE_STRING, 0, 0, FALSE },
{ NM_OPENVPN_KEY_REMOTE, G_TYPE_STRING, 0, 0, FALSE },
+ { NM_OPENVPN_KEY_REMOTE_RANDOM, G_TYPE_BOOLEAN, 0, 0, FALSE },
{ NM_OPENVPN_KEY_REMOTE_IP, G_TYPE_STRING, 0, 0, TRUE },
{ NM_OPENVPN_KEY_RENEG_SECONDS, G_TYPE_INT, 0, G_MAXINT, FALSE },
{ NM_OPENVPN_KEY_STATIC_KEY, G_TYPE_STRING, 0, 0, FALSE },
@@ -775,10 +776,20 @@
tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE);
if (tmp && strlen (tmp)) {
- add_openvpn_arg (args, "--remote");
- add_openvpn_arg (args, tmp);
+ char *tok;
+ while ((tok = strsep((char**)&tmp, " ,")) != NULL) {
+ if (strlen(tok)) {
+ add_openvpn_arg (args, "--remote");
+ add_openvpn_arg (args, tok);
+ }
+ }
}
+ /* Remote random */
+ tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE_RANDOM);
+ if (tmp && !strcmp (tmp, "yes"))
+ add_openvpn_arg (args, "--remote-random");
+
tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PROXY_TYPE);
tmp2 = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PROXY_SERVER);
tmp3 = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PROXY_PORT);
diff -ur NetworkManager-openvpn-0.9.3.995.orig/src/nm-openvpn-service.h NetworkManager-openvpn-0.9.3.995/src/nm-openvpn-service.h
--- NetworkManager-openvpn-0.9.3.995.orig/src/nm-openvpn-service.h 2011-06-03 02:57:47.000000000 +0400
+++ NetworkManager-openvpn-0.9.3.995/src/nm-openvpn-service.h 2012-03-23 00:49:34.778274060 +0400
@@ -56,6 +56,7 @@
#define NM_OPENVPN_KEY_PROXY_RETRY "proxy-retry"
#define NM_OPENVPN_KEY_HTTP_PROXY_USERNAME "http-proxy-username"
#define NM_OPENVPN_KEY_REMOTE "remote"
+#define NM_OPENVPN_KEY_REMOTE_RANDOM "remote-random"
#define NM_OPENVPN_KEY_REMOTE_IP "remote-ip"
#define NM_OPENVPN_KEY_STATIC_KEY "static-key"
#define NM_OPENVPN_KEY_STATIC_KEY_DIRECTION "static-key-direction"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]