Re: [PATCH] openvpn: lack of ipv4 config on tap interface is not fatal



On 05/11/2015 12:38, Rafaël Carré wrote:
Hello,

On 05/11/2015 12:34, Lubomir Rintel wrote:
Hello Rafaël,

I'm not sure I understand this one either. What do you mean it's fatal
now? There's just a g_warning(). Is it that without your other patch
this produces invalid IPv4 config and causes the daemon to tear the
down the connection?

Yes, that is the case at least on 1.0.4.

I tested 1.0.4 because that is what Ubuntu 15.10 is shipping, and I
don't know
how I would be able to test the git version.

Maybe I didn't pay much attention to that code because it changed quite
a bit
between 1.0.4 and git.

Here is the diff I tested:

Sorry, wrong patch:

---
network-manager-openvpn-0.9.10.0.orig/src/nm-openvpn-service-openvpn-helper.c
+++ network-manager-openvpn-0.9.10.0/src/nm-openvpn-service-openvpn-helper.c
@@ -675,7 +675,7 @@ main (int argc, char *argv[])
                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 (ip4config, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
-       } else if (!tapdev) {
+       } else /*if (!tapdev)*/ {
                if (!g_hash_table_lookup (ip4config, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX)) {
                        val = g_slice_new0 (GValue);
                        g_value_init (val, G_TYPE_UINT);



On Tue, 2015-11-03 at 19:31 +0100, Rafaël Carré wrote:
IPv4 config can be set manually
---
 src/nm-openvpn-service-openvpn-helper.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/nm-openvpn-service-openvpn-helper.c b/src/nm-
openvpn-service-openvpn-helper.c
index 512d6ce..4f93193 100644
--- a/src/nm-openvpn-service-openvpn-helper.c
+++ b/src/nm-openvpn-service-openvpn-helper.c
@@ -583,13 +583,10 @@ main (int argc, char *argv[])
    if (tmp && inet_pton (AF_INET, tmp, &temp_addr) > 0) {
            val = g_variant_new_uint32
(nm_utils_ip4_netmask_to_prefix (temp_addr.s_addr));
            g_variant_builder_add (&ip4builder, "{sv}",
NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
-   } else if (!tapdev) {
-           if (!has_ip4_prefix) {
-                   val = g_variant_new_uint32 (32);
-                   g_variant_builder_add (&ip4builder, "{sv}",
NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
-           }
-   } else
-           g_warning ("No IP4 netmask/prefix (missing or
invalid 'ifconfig_netmask')");
+   } else if (!has_ip4_prefix) {
+           val = g_variant_new_uint32 (32);
+           g_variant_builder_add (&ip4builder, "{sv}",
NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
+   }
 
    val = get_ip4_routes ();
    if (val)

Thanks,
Lubo



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]