network-manager-openvpn r19 - in branches/NETWORKMANAGER_0_7: . src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-openvpn r19 - in branches/NETWORKMANAGER_0_7: . src
- Date: Wed, 28 Jan 2009 17:39:57 +0000 (UTC)
Author: dcbw
Date: Wed Jan 28 17:39:57 2009
New Revision: 19
URL: http://svn.gnome.org/viewvc/network-manager-openvpn?rev=19&view=rev
Log:
2009-01-28 Dan Williams <dcbw redhat com>
* src/nm-openvpn-service-openvpn-helper.c
- (main): handle subnets correctly; TAP devices get their netmask
from 'ifconfig_netmask', while TUN devices always use
/32 becuase they are point-to-point
Modified:
branches/NETWORKMANAGER_0_7/ChangeLog
branches/NETWORKMANAGER_0_7/src/nm-openvpn-service-openvpn-helper.c
Modified: branches/NETWORKMANAGER_0_7/src/nm-openvpn-service-openvpn-helper.c
==============================================================================
--- branches/NETWORKMANAGER_0_7/src/nm-openvpn-service-openvpn-helper.c (original)
+++ branches/NETWORKMANAGER_0_7/src/nm-openvpn-service-openvpn-helper.c Wed Jan 28 17:39:57 2009
@@ -287,6 +287,7 @@
GValue *nbns_list = NULL;
GValue *dns_domain = NULL;
struct in_addr temp_addr;
+ gboolean tapdev = FALSE;
g_type_init ();
@@ -310,13 +311,17 @@
if (val)
g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_INT_GATEWAY, val);
- /* Tunnel device */
- val = str_to_gvalue (getenv ("dev"), FALSE);
+ /* VPN device */
+ tmp = getenv ("dev");
+ val = str_to_gvalue (tmp, FALSE);
if (val)
g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV, val);
else
helper_failed (connection, "Tunnel Device");
+ if (strncmp (tmp, "tap", 3) == 0)
+ tapdev = TRUE;
+
/* IP address */
val = addr_to_gvalue (getenv ("ifconfig_local"));
if (val)
@@ -329,15 +334,28 @@
if (val)
g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_PTP, val);
- /* Netmask */
- tmp = getenv ("route_netmask_1");
- if (tmp && inet_pton (AF_INET, tmp, &temp_addr) > 0) {
+ /* Netmask
+ *
+ * TAP devices pass back the netmask, while TUN devices always use /32
+ * since they are point-to-point.
+ */
+ if (tapdev) {
+ tmp = getenv ("ifconfig_netmask");
+ if (tmp && inet_pton (AF_INET, tmp, &temp_addr) > 0) {
+ GValue *val;
+
+ val = g_slice_new0 (GValue);
+ g_value_init (val, G_TYPE_UINT);
+ g_value_set_uint (val, nm_utils_ip4_netmask_to_prefix (temp_addr.s_addr));
+
+ g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
+ }
+ } else {
GValue *val;
val = g_slice_new0 (GValue);
g_value_init (val, G_TYPE_UINT);
- g_value_set_uint (val, nm_utils_ip4_netmask_to_prefix (temp_addr.s_addr));
-
+ g_value_set_uint (val, 32);
g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]