Browse code

repair --dev null breakage caused by db950be85d37

"make check" self-test was broken after commit db950be85d37 due to
do_ifconfig_setenv() not checking whether tt->did_ifconfig_setup
was set (which isn't, for "dev null" type setups)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <1432404098-29401-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9718
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Gert Doering authored on 2015/05/24 02:35:05
Showing 1 changed files
... ...
@@ -403,23 +403,27 @@ void
403 403
 do_ifconfig_setenv (const struct tuntap *tt, struct env_set *es)
404 404
 {
405 405
     struct gc_arena gc = gc_new ();
406
-    bool tun = is_tun_p2p (tt);
407 406
     const char *ifconfig_local = print_in_addr_t (tt->local, 0, &gc);
408 407
     const char *ifconfig_remote_netmask = print_in_addr_t (tt->remote_netmask, 0, &gc);
409 408
 
410 409
     /*
411 410
      * Set environmental variables with ifconfig parameters.
412 411
      */
413
-    setenv_str (es, "ifconfig_local", ifconfig_local);
414
-    if (tun)
412
+    if (tt->did_ifconfig_setup)
415 413
     {
416
-	setenv_str (es, "ifconfig_remote", ifconfig_remote_netmask);
417
-    }
418
-    else
419
-    {
420
-	const char *ifconfig_broadcast = print_in_addr_t (tt->broadcast, 0, &gc);
421
-	setenv_str (es, "ifconfig_netmask", ifconfig_remote_netmask);
422
-	setenv_str (es, "ifconfig_broadcast", ifconfig_broadcast);
414
+	bool tun = is_tun_p2p (tt);
415
+
416
+	setenv_str (es, "ifconfig_local", ifconfig_local);
417
+	if (tun)
418
+	{
419
+	    setenv_str (es, "ifconfig_remote", ifconfig_remote_netmask);
420
+	}
421
+	else
422
+	{
423
+	    const char *ifconfig_broadcast = print_in_addr_t (tt->broadcast, 0, &gc);
424
+	    setenv_str (es, "ifconfig_netmask", ifconfig_remote_netmask);
425
+	    setenv_str (es, "ifconfig_broadcast", ifconfig_broadcast);
426
+	}
423 427
     }
424 428
 
425 429
     if (tt->did_ifconfig_ipv6_setup)