]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix pool logging when IPv6 is not enabled
authorDavid Sommerseth <dazo@users.sourceforge.net>
Sat, 14 Jan 2012 11:34:59 +0000 (12:34 +0100)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Sat, 14 Jan 2012 17:18:55 +0000 (18:18 +0100)
If IPv6 tunnelling is not enabled, a bogus IPv6 address would be
printed in the log, like this:

  MULTI_sva: pool returned IPv4=10.8.0.4, IPv6=2180:8:2100:0:d4b4:f11d:18bf:2f00

It turns out that the remote_ipv6 buffer was not cleared.  Added
an extra check to also replace a "IPv6=::" log message with
information that the IPv6 feature is disabled in these cases.

Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
multi.c

diff --git a/multi.c b/multi.c
index 9535f43adea2d322a20899c81b4a8d0a680498f4..65a834b0f1f67b13915d86d162c7855b42223cf1 100644 (file)
--- a/multi.c
+++ b/multi.c
@@ -1307,6 +1307,7 @@ multi_select_virtual_addr (struct multi_context *m, struct multi_instance *mi)
       if (!mi->context.options.duplicate_cn)
        cn = tls_common_name (mi->context.c2.tls_multi, true);
 
+      CLEAR(remote_ipv6);
       mi->vaddr_handle = ifconfig_pool_acquire (m->ifconfig_pool, &local, &remote, &remote_ipv6, cn);
       if (mi->vaddr_handle >= 0)
        {
@@ -1314,8 +1315,10 @@ multi_select_virtual_addr (struct multi_context *m, struct multi_instance *mi)
          const int tunnel_topology = TUNNEL_TOPOLOGY (mi->context.c1.tuntap);
 
          msg( M_INFO, "MULTI_sva: pool returned IPv4=%s, IPv6=%s", 
-                   print_in_addr_t( remote, 0, &gc ),
-                   print_in6_addr( remote_ipv6, 0, &gc ) );
+              print_in_addr_t( remote, 0, &gc ),
+              (mi->context.options.ifconfig_ipv6_pool_defined
+               ? print_in6_addr( remote_ipv6, 0, &gc )
+               : "(Not enabled)") );
 
          /* set push_ifconfig_remote_netmask from pool ifconfig address(es) */
          mi->context.c2.push_ifconfig_local = remote;