diff --git a/vpn-daemons/openvpn/ChangeLog b/vpn-daemons/openvpn/ChangeLog index 856dc74415..08ee58eb1b 100644 --- a/vpn-daemons/openvpn/ChangeLog +++ b/vpn-daemons/openvpn/ChangeLog @@ -1,3 +1,8 @@ +2008-08-22 Dan Williams + + * src/nm-openvpn-service-openvpn-helper.c + - (main): grab tunnel MTU and push that through to NM + 2008-08-18 Claude Paroz * properties/nm-openvpn-dialog.glade: Removed translatable property on non diff --git a/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c b/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c index f4c4cd7502..f15262882a 100644 --- a/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c +++ b/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c @@ -126,6 +126,21 @@ str_to_gvalue (const char *str, gboolean try_convert) return val; } +static GValue * +uint_to_gvalue (guint32 num) +{ + GValue *val; + + if (num == 0) + return NULL; + + val = g_slice_new0 (GValue); + g_value_init (val, G_TYPE_UINT); + g_value_set_uint (val, num); + + return val; +} + static GValue * addr_to_gvalue (const char *str) { @@ -356,6 +371,21 @@ main (int argc, char *argv[]) if (dns_domain) g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_DOMAIN, dns_domain); + /* Tunnel MTU */ + tmp = getenv ("tun_mtu"); + if (tmp && strlen (tmp)) { + long int mtu; + + errno = 0; + mtu = strtol (tmp, NULL, 10); + if (errno || mtu < 0 || mtu > 20000) { + nm_warning ("Ignoring invalid tunnel MTU '%s'", tmp); + } else { + val = uint_to_gvalue ((guint32) mtu); + g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_MTU, val); + } + } + /* Send the config info to nm-openvpn-service */ send_ip4_config (connection, config);