Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 663111 Details for
Bug 845599
Cannot connect to Cisco VPN using NM-openswan plugin
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
[PATCH] NM patch correcting the behaviour when no tun device is used
0001-vpn-fix-VPN-connections-for-plugins-not-using-TUN-TA.patch (text/plain), 8.17 KB, created by
Jirka Klimes
on 2012-12-13 18:25:12 UTC
(
hide
)
Description:
[PATCH] NM patch correcting the behaviour when no tun device is used
Filename:
MIME Type:
Creator:
Jirka Klimes
Created:
2012-12-13 18:25:12 UTC
Size:
8.17 KB
patch
obsolete
>From b3860978d7ad758dbdac248d3d481a86457523c6 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com> >Date: Thu, 13 Dec 2012 18:51:01 +0100 >Subject: [PATCH] vpn: fix VPN connections for plugins not using TUN/TAP > interface (rh #845599) >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >It is openswan, for example. > >The plugin indicates that it doesn't use tun/tap via special value of "_none_" >for "tundev" config parameter. > >All occurences where ip interface name (index) is expected are replaced by the >interface of the parent device. > >Signed-off-by: JiÅà KlimeÅ¡ <jklimes@redhat.com> >--- > include/NetworkManagerVPN.h | 6 +++- > src/nm-dispatcher.c | 4 +-- > src/nm-policy.c | 29 ++++++++++++++++--- > src/vpn-manager/nm-vpn-connection.c | 55 +++++++++++++++++++++---------------- > 4 files changed, 64 insertions(+), 30 deletions(-) > >diff --git a/include/NetworkManagerVPN.h b/include/NetworkManagerVPN.h >index 6e654b3..95da47a 100644 >--- a/include/NetworkManagerVPN.h >+++ b/include/NetworkManagerVPN.h >@@ -16,7 +16,7 @@ > * with this program; if not, write to the Free Software Foundation, Inc., > * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > * >- * (C) Copyright 2004 Red Hat, Inc. >+ * (C) Copyright 2004 - 2012 Red Hat, Inc. > */ > > #ifndef NETWORK_MANAGER_VPN_H >@@ -134,6 +134,10 @@ typedef enum { > /* boolean: Has IP6 configuration? */ > #define NM_VPN_PLUGIN_CONFIG_HAS_IP6 "has-ip6" > >+/* --- values ---*/ >+/* Value for NM_VPN_PLUGIN_CONFIG_TUNDEV indicating no virtual interface is used */ >+#define NM_VPN_PLUGIN_CONFIG_TUNDEV_NONE "_none_" >+ > > /*** Ip4Config ***/ > >diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c >index 61dfd7c..24a5ead 100644 >--- a/src/nm-dispatcher.c >+++ b/src/nm-dispatcher.c >@@ -315,8 +315,8 @@ _dispatcher_call (DispatcherAction action, > device_ip6_props, > device_dhcp4_props, > device_dhcp6_props); >- if (vpn_iface) >- fill_vpn_props (vpn_ip4_config, NULL, vpn_ip4_props, vpn_ip6_props); >+ >+ fill_vpn_props (vpn_ip4_config, NULL, vpn_ip4_props, vpn_ip6_props); > } > > info = g_malloc0 (sizeof (*info)); >diff --git a/src/nm-policy.c b/src/nm-policy.c >index ca7e0dc..17969c6 100644 >--- a/src/nm-policy.c >+++ b/src/nm-policy.c >@@ -510,10 +510,16 @@ get_best_ip4_config (NMPolicy *policy, > *out_vpn = candidate; > if (out_ac) > *out_ac = NM_ACTIVE_CONNECTION (candidate); >- if (out_ip_iface) >+ if (out_ip_iface) { > *out_ip_iface = nm_vpn_connection_get_ip_iface (candidate); >- if (out_ip_ifindex) >+ if (*out_ip_iface == NULL) >+ *out_ip_iface = nm_device_get_ip_iface (nm_vpn_connection_get_parent_device (candidate)); >+ } >+ if (out_ip_ifindex) { > *out_ip_ifindex = nm_vpn_connection_get_ip_ifindex (candidate); >+ if (*out_ip_ifindex <= 0) >+ *out_ip_ifindex = nm_device_get_ifindex (nm_vpn_connection_get_parent_device (candidate)); >+ } > break; > } > g_slist_free (vpns); >@@ -675,10 +681,17 @@ get_best_ip6_config (NMPolicy *policy, > *out_vpn = candidate; > if (out_ac) > *out_ac = NM_ACTIVE_CONNECTION (candidate); >- if (out_ip_iface) >+ if (out_ip_iface) { > *out_ip_iface = nm_vpn_connection_get_ip_iface (candidate); >- if (out_ip_ifindex) >+ if (*out_ip_iface == NULL) >+ *out_ip_iface = nm_device_get_ip_iface (nm_vpn_connection_get_parent_device (candidate)); >+ >+ } >+ if (out_ip_ifindex) { > *out_ip_ifindex = nm_vpn_connection_get_ip_ifindex (candidate); >+ if (*out_ip_ifindex <= 0) >+ *out_ip_ifindex = nm_device_get_ifindex (nm_vpn_connection_get_parent_device (candidate)); >+ } > break; > } > g_slist_free (vpns); >@@ -1053,6 +1066,10 @@ vpn_connection_activated (NMVPNManager *manager, > > ip_iface = nm_vpn_connection_get_ip_iface (vpn); > >+ /* When no virtual VPN device use parent device name */ >+ if (!ip_iface) >+ ip_iface = nm_device_get_ip_iface (nm_vpn_connection_get_parent_device (vpn)); >+ > /* Add the VPN connection's IP configs from DNS */ > > ip4_config = nm_vpn_connection_get_ip4_config (vpn); >@@ -1090,6 +1107,10 @@ vpn_connection_deactivated (NMVPNManager *manager, > ip_iface = nm_vpn_connection_get_ip_iface (vpn); > parent = nm_vpn_connection_get_parent_device (vpn); > >+ /* When no virtual VPN device use parent device name */ >+ if (!ip_iface) >+ ip_iface = nm_device_get_ip_iface (parent); >+ > ip4_config = nm_vpn_connection_get_ip4_config (vpn); > if (ip4_config) { > /* Remove the VPN connection's IP4 config from DNS */ >diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c >index 3f6c0bc..671bc11 100644 >--- a/src/vpn-manager/nm-vpn-connection.c >+++ b/src/vpn-manager/nm-vpn-connection.c >@@ -525,7 +525,7 @@ print_vpn_config (NMVPNConnection *connection) > ip6_address_to_string (priv->ip6_external_gw)); > } > >- nm_log_info (LOGD_VPN, "Tunnel Device: %s", priv->ip_iface); >+ nm_log_info (LOGD_VPN, "Tunnel Device: %s", priv->ip_iface ? priv->ip_iface : "(not used)"); > > if (priv->ip4_config) { > nm_log_info (LOGD_VPN, "IPv4 configuration:"); >@@ -620,19 +620,22 @@ nm_vpn_connection_apply_config (NMVPNConnection *connection) > { > NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection); > >- nm_system_iface_set_up (priv->ip_ifindex, TRUE, NULL); >+ /* Some VPN plugins (e.g. openswan) don't use virtual TUN/TAP device */ >+ if (priv->ip_ifindex > 0) { >+ nm_system_iface_set_up (priv->ip_ifindex, TRUE, NULL); > >- if (priv->ip4_config) { >- if (!nm_system_apply_ip4_config (priv->ip_ifindex, priv->ip4_config, >- 0, NM_IP4_COMPARE_FLAG_ALL)) >- return FALSE; >- } >+ if (priv->ip4_config) { >+ if (!nm_system_apply_ip4_config (priv->ip_ifindex, priv->ip4_config, >+ 0, NM_IP4_COMPARE_FLAG_ALL)) >+ return FALSE; >+ } > >- if (priv->ip6_config) { >- if (!nm_system_apply_ip6_config (priv->ip_ifindex, priv->ip6_config, >- 0, NM_IP6_COMPARE_FLAG_ALL)) >- /* FIXME: remove ip4 config */ >- return FALSE; >+ if (priv->ip6_config) { >+ if (!nm_system_apply_ip6_config (priv->ip_ifindex, priv->ip6_config, >+ 0, NM_IP6_COMPARE_FLAG_ALL)) >+ /* FIXME: remove ip4 config */ >+ return FALSE; >+ } > } > > /* Add any explicit route to the VPN gateway through the parent device */ >@@ -703,22 +706,27 @@ process_generic_config (NMVPNConnection *connection, > GValue *val; > > val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_CONFIG_TUNDEV); >- if (val) >- priv->ip_iface = g_strdup (g_value_get_string (val)); >+ if (val) { >+ const char *iface = g_value_get_string (val); >+ >+ /* When tundev is used, translate it to interface index */ >+ if (g_strcmp0 (iface, NM_VPN_PLUGIN_CONFIG_TUNDEV_NONE) != 0) { >+ /* Grab the interface index for address/routing operations */ >+ priv->ip_ifindex = nm_netlink_iface_to_index (iface); >+ if (priv->ip_ifindex <= 0) { >+ nm_log_err (LOGD_VPN, "(%s): failed to look up VPN interface index", iface); >+ nm_vpn_connection_config_maybe_complete (connection, FALSE); >+ return FALSE; >+ } >+ priv->ip_iface = g_strdup (iface); >+ } >+ } > else { > nm_log_err (LOGD_VPN, "invalid or missing tunnel device received!"); > nm_vpn_connection_config_maybe_complete (connection, FALSE); > return FALSE; > } > >- /* Grab the interface index for address/routing operations */ >- priv->ip_ifindex = nm_netlink_iface_to_index (priv->ip_iface); >- if (priv->ip_ifindex <= 0) { >- nm_log_err (LOGD_VPN, "(%s): failed to look up VPN interface index", priv->ip_iface); >- nm_vpn_connection_config_maybe_complete (connection, FALSE); >- return FALSE; >- } >- > val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_CONFIG_BANNER); > if (val) { > g_free (priv->banner); >@@ -738,7 +746,8 @@ process_generic_config (NMVPNConnection *connection, > if (ba->len == sizeof (struct in6_addr)) > priv->ip6_external_gw = g_memdup (ba->data, ba->len); > } else { >- nm_log_err (LOGD_VPN, "(%s): VPN gateway is neither IPv4 nor IPv6", priv->ip_iface); >+ nm_log_err (LOGD_VPN, "(%s): VPN gateway is neither IPv4 nor IPv6", >+ priv->ip_iface ? priv->ip_iface : "none"); > nm_vpn_connection_config_maybe_complete (connection, FALSE); > return FALSE; > } >-- >1.7.11.7 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 845599
: 663111 |
663112