Skip to contentSkip to conversation

Fix environment variables for p2mp-assigned IPv6 addresses.

PATCH In review Gert Doering 2 participants 3 messages Jul 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix environment variables for p2mp-assigned IPv6 addresses.

commit a8f8b926718 introduces $ENV{ifconfig_pool_local_ip6} and $ENV{ifconfig_pool_remote_ip6}, but instead of properly setting them, the code overwrites the IPv4 variables, $ENV{ifconfig_pool_remote} and $ENV{ifconfig_pool_local}.

Trivial fix.

---
 src/openvpn/multi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/multi.c +2 -2
index fe8fcd50..01da8c73 100644
@@ -1624,11 +1624,11 @@ multi_set_virtual_addr_env(struct multi_instance *mi)
     if (mi->context.c2.push_ifconfig_ipv6_defined)
     {
         setenv_in6_addr(mi->context.c2.es,
-                        "ifconfig_pool_remote",
+                        "ifconfig_pool_remote_ip6",
                         &mi->context.c2.push_ifconfig_ipv6_local,
                         SA_SET_IF_NONZERO);
         setenv_in6_addr(mi->context.c2.es,
-                        "ifconfig_pool_local",
+                        "ifconfig_pool_local_ip6",
                         &mi->context.c2.push_ifconfig_ipv6_remote,
                         SA_SET_IF_NONZERO);
         setenv_int(mi->context.c2.es,
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw

Am 15.07.20 um 13:31 schrieb Gert Doering:

Quoted 7 lines

commit a8f8b926718 introduces $ENV{ifconfig_pool_local_ip6} and $ENV{ifconfig_pool_remote_ip6}, but instead of properly setting them, the code overwrites the IPv4 variables, $ENV{ifconfig_pool_remote} and $ENV{ifconfig_pool_local}.

Trivial fix.

#2 lore raw
In reply to Gert Doering

Hi,

Quoted 8 lines · Gert Doering

commit a8f8b926718 introduces $ENV{ifconfig_pool_local_ip6} and $ENV{ifconfig_pool_remote_ip6}, but instead of properly setting them, the code overwrites the IPv4 variables, $ENV{ifconfig_pool_remote} and $ENV{ifconfig_pool_local}.

Trivial fix.

And while the fix looks trivially right, it isn't... setenv_in6_addr() calls setenv_sockaddr() which does

	openvpn_snprintf(name_buf, sizeof(name_buf), "%s_ip6", name_prefix);
	getnameinfo(&addr->addr.sa, sizeof(struct sockaddr_in6),
		    buf, sizeof(buf), NULL, 0, NI_NUMERICHOST);

so with the patch, I end up with

ifconfig_pool_local_ip6_ip6=fd00:abcd:204:5::1
ifconfig_pool_remote_ip6_ip6=fd00:abcd:204:5::2

seems the original code is not easy to understand, but correct.

So, NACK.

Taking "talking to myself" to new levels :-)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...