[network-manager-openvpn] src: preserve IP route configuration on restart
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn] src: preserve IP route configuration on restart
- Date: Mon, 4 Jul 2016 08:57:40 +0000 (UTC)
commit 9e90d37abf6b3a02d487bf892fa926715cc1064e
Author: Thomas Haller <thaller redhat com>
Date: Mon Jul 4 10:33:01 2016 +0200
src: preserve IP route configuration on restart
During restart, openvpn does not provide the routing information to the
helper script. Make use of a new option to tell NetworkManager to re-use
the previous configuration.
The "preserve-routes" defines are obtained from the shared header file
"nm-vpn-plugin-macros.h" so that we don't have to bump required API.
https://bugzilla.redhat.com/show_bug.cgi?id=1231338
https://bugzilla.gnome.org/show_bug.cgi?id=750873
shared/nm-utils/nm-vpn-plugin-macros.h | 14 ++++++++++++++
src/nm-openvpn-service-openvpn-helper.c | 10 ++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/shared/nm-utils/nm-vpn-plugin-macros.h b/shared/nm-utils/nm-vpn-plugin-macros.h
index d685934..c85ef17 100644
--- a/shared/nm-utils/nm-vpn-plugin-macros.h
+++ b/shared/nm-utils/nm-vpn-plugin-macros.h
@@ -39,5 +39,19 @@ nm_utils_syslog_to_str (int syslog_level)
return "<error>";
}
+/*****************************************************************************/
+
+/* possibly missing defines from newer libnm API. */
+
+#ifndef NM_VPN_PLUGIN_IP4_CONFIG_PRESERVE_ROUTES
+#define NM_VPN_PLUGIN_IP4_CONFIG_PRESERVE_ROUTES "preserve-routes"
+#endif
+
+#ifndef NM_VPN_PLUGIN_IP6_CONFIG_PRESERVE_ROUTES
+#define NM_VPN_PLUGIN_IP6_CONFIG_PRESERVE_ROUTES "preserve-routes"
+#endif
+
+/*****************************************************************************/
+
#endif /* __NM_VPN_PLUGIN_MACROS_H__ */
diff --git a/src/nm-openvpn-service-openvpn-helper.c b/src/nm-openvpn-service-openvpn-helper.c
index 0550cd7..5612e8a 100644
--- a/src/nm-openvpn-service-openvpn-helper.c
+++ b/src/nm-openvpn-service-openvpn-helper.c
@@ -640,6 +640,11 @@ main (int argc, char *argv[])
val = get_ip4_routes ();
if (val)
g_variant_builder_add (&ip4builder, "{sv}", NM_VPN_PLUGIN_IP4_CONFIG_ROUTES, val);
+ else if (is_restart) {
+ g_variant_builder_add (&ip4builder, "{sv}",
+ NM_VPN_PLUGIN_IP4_CONFIG_PRESERVE_ROUTES,
+ g_variant_new_boolean (TRUE));
+ }
/* IPv6 address */
tmp = getenv ("ifconfig_ipv6_local");
@@ -680,6 +685,11 @@ main (int argc, char *argv[])
val = get_ip6_routes ();
if (val)
g_variant_builder_add (&ip6builder, "{sv}", NM_VPN_PLUGIN_IP6_CONFIG_ROUTES, val);
+ else if (is_restart) {
+ g_variant_builder_add (&ip6builder, "{sv}",
+ NM_VPN_PLUGIN_IP6_CONFIG_PRESERVE_ROUTES,
+ g_variant_new_boolean (TRUE));
+ }
/* DNS and WINS servers */
dns_domains = g_ptr_array_sized_new (3);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]