put virtual IPv6 addresses into env
PATCH 1/1 put virtual IPv6 addresses into env
Add missing environment variables for IPv6 virtual addresses:
* ifconfig_pool_local_ipv6
* ifconfig_pool_remote_ipv6
* ifconfig_pool_ipv6_netbits
--- src/openvpn/multi.c | 22 ++++++++++++++++++---- src/openvpn/socket.c | 16 ++++++++++++++++ src/openvpn/socket.h | 5 +++++ 3 files changed, 39 insertions(+), 4 deletions(-)
src/openvpn/multi.c +18 -4
@@ -1432,10 +1432,24 @@ multi_set_virtual_addr_env (struct multi_context *m, struct multi_instance *mi) } } -/* TODO: I'm not exactly sure what these environment variables are -* used for, but if we have them for IPv4, we should also have -* them for IPv6, no? -*/ +setenv_del (mi->context.c2.es,"ifconfig_pool_local_ipv6" ); +setenv_del (mi->context.c2.es,"ifconfig_pool_remote_ipv6" ); +setenv_del (mi->context.c2.es,"ifconfig_pool_ipv6_netbits" ); + +if (mi->context.c1.tuntap->ipv6 && mi->context.c2.push_ifconfig_ipv6_defined) + { +setenv_in6_addr (mi->context.c2.es, +"ifconfig_pool_remote_ipv6" , + &mi->context.c2.push_ifconfig_ipv6_local, +SA_SET_IF_NONZERO ); +setenv_in6_addr (mi->context.c2.es, +"ifconfig_pool_local_ipv6" , + &mi->context.c2.push_ifconfig_ipv6_remote, +SA_SET_IF_NONZERO ); +setenv_int (mi->context.c2.es, +"ifconfig_pool_ipv6_netbits" , + mi->context.c2.push_ifconfig_ipv6_netbits); + } }/*
src/openvpn/socket.c +16 -0
@@ -2443,6 +2443,22 @@ setenv_in_addr_t (struct env_set *es, const char *name_prefix, in_addr_t addr, c }void +setenv_in6_addr (struct env_set *es, +const char *name_prefix, +const struct in6_addr *addr, +const unsigned int flags) +{ +if (!IN6_IS_ADDR_UNSPECIFIED (addr) || !(flags &SA_SET_IF_NONZERO )) + { +struct openvpn_sockaddr si; +CLEAR (si); + si.addr.in6.sin6_family =AF_INET6 ; +memcpy (&si.addr.in6.sin6_addr, addr,sizeof (*addr)); +setenv_sockaddr (es, name_prefix, &si, flags|SA_NO_IP_SUFFIX ); + } +} + +void setenv_link_socket_actual (struct env_set *es, const char *name_prefix, const struct link_socket_actual *act,
src/openvpn/socket.h +5 -0
@@ -410,6 +410,11 @@ void setenv_in_addr_t (struct env_set *es,in_addr_t addr, const unsigned int flags); +void setenv_in6_addr (struct env_set *es, +const char *name_prefix, +const struct in6_addr *addr, +const unsigned int flags); + void setenv_link_socket_actual (struct env_set *es, const char *name_prefix, const struct link_socket_actual *act,
--
1.8.2.3
Sophos Technology GmbH, Amalienbadstraẞe 41/Bau 52, D-76227 Karlsruhe, Deutschland
Tel +49 (0)721 25516 0 Fax +49 (0)721 25516 200 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Karlsruhe, Amtsgericht Mannheim HRB 712658
Geschäftsführer: Nicholas Bray, Pino von Kienlin, Wolfgang Hilpert, Jennifer Onslow.
Sophos GmbH, Gustav-Stresemann-Ring 1, 65189 Wiesbaden, Deutschland
Tel +49 (0) 611 5858-0 Fax +49 (0) 611 5858-1042 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Wiesbaden, Amtsgericht Wiesbaden HRB 25915 Geschäftsführer: Nicholas Bray, Wolfgang Hilpert, Pino von Kienlin, Jennifer Onslow
Hi,
Quoted 7 lines · Heiko Hund
Add missing environment variables for IPv6 virtual addresses:
*
ifconfig_pool_local_ipv6
*ifconfig_pool_remote_ipv6
*ifconfig_pool_ipv6_netbitsSigned-off-by Heiko Hund <[email protected]...>
Semi-ACK. I'm not exactly sure, but your patch refused to apply for me - git am or git apply both give less than helpful refusal messages:
error: patch failed: src/openvpn/multi.c:1432
error: src/openvpn/multi.c: patch does not apply
error: patch failed: src/openvpn/socket.c:2443
error: src/openvpn/socket.c: patch does not apply
error: patch failed: src/openvpn/socket.h:410
error: src/openvpn/socket.h: patch does not apply
while plain old patch against master suggests that your patch might be against release/2.3+local patches
patching file src/openvpn/multi.c
Hunk #1 succeeded at 1504 with fuzz 1 (offset 72 lines). patching file src/openvpn/socket.c
Hunk #1 succeeded at 2608 with fuzz 2 (offset 165 lines). patching file src/openvpn/socket.h
Hunk #1 succeeded at 402 with fuzz 2 (offset -8 lines).
could you rebase to master and re-send, please?
While at it:
src/openvpn/socket.c setenv_in_addr_t (struct env_set *es, const char *name_prefix, in_addr_t addr, c · line 2457
Quoted 8 lines
src/openvpn/socket.c +8
-0+{ +if (!IN6_IS_ADDR_UNSPECIFIED (addr) || !(flags &SA_SET_IF_NONZERO )) + { +struct openvpn_sockaddr si; +CLEAR (si); + si.addr.in6.sin6_family =AF_INET6 ; +memcpy (&si.addr.in6.sin6_addr, addr,sizeof (*addr)); +setenv_sockaddr (es, name_prefix, &si, flags|SA_NO_IP_SUFFIX );
... most of the other code I've seen that deals with sin6_addr will just assign the structure
+ si.addr.in6.sin6_addr = *addr;
(which calls memcpy() under the hood, of course). While mostly a matter of taste, it's actually stronger type-checking to ensure the target structure is the same, aka "has enough room to copy in".
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...PATCH v2 1/1 put virtual IPv6 addresses into env
In reply to Heiko HundAdd missing environment variables for IPv6 virtual addresses:
* ifconfig_pool_local_ipv6
* ifconfig_pool_remote_ipv6
* ifconfig_pool_ipv6_netbits
--- src/openvpn/multi.c | 22 ++++++++++++++++++---- src/openvpn/socket.c | 16 ++++++++++++++++ src/openvpn/socket.h | 5 +++++ 3 files changed, 39 insertions(+), 4 deletions(-)
src/openvpn/multi.c +18 -4
@@ -1506,10 +1506,24 @@ multi_set_virtual_addr_env (struct multi_context *m, struct multi_instance *mi) } } -/* TODO: I'm not exactly sure what these environment variables are -* used for, but if we have them for IPv4, we should also have -* them for IPv6, no? -*/ +setenv_del (mi->context.c2.es,"ifconfig_pool_local_ipv6" ); +setenv_del (mi->context.c2.es,"ifconfig_pool_remote_ipv6" ); +setenv_del (mi->context.c2.es,"ifconfig_pool_ipv6_netbits" ); + +if (mi->context.c1.tuntap->ipv6 && mi->context.c2.push_ifconfig_ipv6_defined) + { +setenv_in6_addr (mi->context.c2.es, +"ifconfig_pool_remote_ipv6" , + &mi->context.c2.push_ifconfig_ipv6_local, +SA_SET_IF_NONZERO ); +setenv_in6_addr (mi->context.c2.es, +"ifconfig_pool_local_ipv6" , + &mi->context.c2.push_ifconfig_ipv6_remote, +SA_SET_IF_NONZERO ); +setenv_int (mi->context.c2.es, +"ifconfig_pool_ipv6_netbits" , + mi->context.c2.push_ifconfig_ipv6_netbits); + } }/*
src/openvpn/socket.c +16 -0
@@ -2611,6 +2611,22 @@ setenv_in_addr_t (struct env_set *es, const char *name_prefix, in_addr_t addr, c }void +setenv_in6_addr (struct env_set *es, +const char *name_prefix, +const struct in6_addr *addr, +const unsigned int flags) +{ +if (!IN6_IS_ADDR_UNSPECIFIED (addr) || !(flags &SA_SET_IF_NONZERO )) + { +struct openvpn_sockaddr si; +CLEAR (si); + si.addr.in6.sin6_family =AF_INET6 ; + si.addr.in6.sin6_addr = *addr; +setenv_sockaddr (es, name_prefix, &si, flags|SA_NO_IP_SUFFIX ); + } +} + +void setenv_link_socket_actual (struct env_set *es, const char *name_prefix, const struct link_socket_actual *act,
src/openvpn/socket.h +5 -0
@@ -402,6 +402,11 @@ void setenv_in_addr_t (struct env_set *es,in_addr_t addr, const unsigned int flags); +void setenv_in6_addr (struct env_set *es, +const char *name_prefix, +const struct in6_addr *addr, +const unsigned int flags); + void setenv_link_socket_actual (struct env_set *es, const char *name_prefix, const struct link_socket_actual *act,
--
1.8.2.3
Sophos Technology GmbH, Amalienbadstraẞe 41/Bau 52, D-76227 Karlsruhe, Deutschland
Tel +49 (0)721 25516 0 Fax +49 (0)721 25516 200 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Karlsruhe, Amtsgericht Mannheim HRB 712658
Geschäftsführer: Nicholas Bray, Pino von Kienlin, Wolfgang Hilpert, Jennifer Onslow.
Sophos GmbH, Gustav-Stresemann-Ring 1, 65189 Wiesbaden, Deutschland
Tel +49 (0) 611 5858-0 Fax +49 (0) 611 5858-1042 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Wiesbaden, Amtsgericht Wiesbaden HRB 25915 Geschäftsführer: Nicholas Bray, Wolfgang Hilpert, Pino von Kienlin, Jennifer Onslow
Ho Hum,
Quoted 7 lines · Heiko Hund
Add missing environment variables for IPv6 virtual addresses:
*
ifconfig_pool_local_ipv6
*ifconfig_pool_remote_ipv6
*ifconfig_pool_ipv6_netbitsSigned-off-by Heiko Hund <[email protected]...>
[..]
There's two problems with it, unfortunately... first problem is that your exchange server ("Received:" header #1) seems to stubbornly mangle all tabs into 8 spaces - so the context of the patch does not match the context in tree, and the patch doesn't apply. Since sophos *does* have a real MTA (postfix) further down the line - could that one be used directly...?
But this is just a secondary thing for this patch as the patch is small (so I could fix this by hand) - more complicated is this one:
src/openvpn/socket.c setenv_in_addr_t (struct env_set *es, const char *name_prefix, in_addr_t addr, c · line 2625
Quoted 13 lines
void
src/openvpn/socket.c +12
-0+setenv_in6_addr (struct env_set *es, + const char *name_prefix, + const struct in6_addr *addr, + const unsigned int flags) +{ + if (!IN6_IS_ADDR_UNSPECIFIED (addr) || !(flags & SA_SET_IF_NONZERO)) + { + struct openvpn_sockaddr si; + CLEAR (si); + si.addr.in6.sin6_family =AF_INET6 ; + si.addr.in6.sin6_addr = *addr; +setenv_sockaddr (es, name_prefix, &si, flags|SA_NO_IP_SUFFIX );
... what does "SA_NO_IP_SUFFIX" do? I've searched release/2.2, 2.3 and git master, and couldn't find any trace of it - so it's not something we lost during socket.c rewrite, but seemingly something we never received...
I assume it is related to this stuff...
openvpn_snprintf (name_buf, sizeof (name_buf), "%s_ip", name_prefix);
openvpn_snprintf (name_buf, sizeof (name_buf), "%s_ip6", name_prefix);... tacking a _ip(6) suffix to the name_prefix (or specifically, "not").
Where else do you use that? Is this something we'd want to have?
thanks,
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...PATCH v3 1/1 put virtual IPv6 addresses into env
In reply to Heiko HundAdd missing environment variables for IPv6 virtual addresses:
* ifconfig_pool_local_ip6
* ifconfig_pool_remote_ip6
* ifconfig_pool_ip6_netbits
--- src/openvpn/multi.c | 22 ++++++++++++++++++---- src/openvpn/socket.c | 16 ++++++++++++++++ src/openvpn/socket.h | 5 +++++ 3 files changed, 39 insertions(+), 4 deletions(-)
src/openvpn/multi.c +18 -4
@@ -1506,10 +1506,24 @@ multi_set_virtual_addr_env (struct multi_context *m, struct multi_instance *mi) } } -/* TODO: I'm not exactly sure what these environment variables are -* used for, but if we have them for IPv4, we should also have -* them for IPv6, no? -*/ +setenv_del (mi->context.c2.es,"ifconfig_pool_local_ip6" ); +setenv_del (mi->context.c2.es,"ifconfig_pool_remote_ip6" ); +setenv_del (mi->context.c2.es,"ifconfig_pool_ip6_netbits" ); + +if (mi->context.c1.tuntap->ipv6 && mi->context.c2.push_ifconfig_ipv6_defined) + { +setenv_in6_addr (mi->context.c2.es, +"ifconfig_pool_remote" , + &mi->context.c2.push_ifconfig_ipv6_local, +SA_SET_IF_NONZERO ); +setenv_in6_addr (mi->context.c2.es, +"ifconfig_pool_local" , + &mi->context.c2.push_ifconfig_ipv6_remote, +SA_SET_IF_NONZERO ); +setenv_int (mi->context.c2.es, +"ifconfig_pool_ip6_netbits" , + mi->context.c2.push_ifconfig_ipv6_netbits); + } }/*
src/openvpn/socket.c +16 -0
@@ -2611,6 +2611,22 @@ setenv_in_addr_t (struct env_set *es, const char *name_prefix, in_addr_t addr, c }void +setenv_in6_addr (struct env_set *es, +const char *name_prefix, +const struct in6_addr *addr, +const unsigned int flags) +{ +if (!IN6_IS_ADDR_UNSPECIFIED (addr) || !(flags &SA_SET_IF_NONZERO )) + { +struct openvpn_sockaddr si; +CLEAR (si); + si.addr.in6.sin6_family =AF_INET6 ; + si.addr.in6.sin6_addr = *addr; +setenv_sockaddr (es, name_prefix, &si, flags); + } +} + +void setenv_link_socket_actual (struct env_set *es, const char *name_prefix, const struct link_socket_actual *act,
src/openvpn/socket.h +5 -0
@@ -402,6 +402,11 @@ void setenv_in_addr_t (struct env_set *es,in_addr_t addr, const unsigned int flags); +void setenv_in6_addr (struct env_set *es, +const char *name_prefix, +const struct in6_addr *addr, +const unsigned int flags); + void setenv_link_socket_actual (struct env_set *es, const char *name_prefix, const struct link_socket_actual *act,
Signature · 1 line
1.7.9.5
ACK, thanks.
Your patch has been applied to the master and release/2.3 branch.
commit a8f8b9267183c3cfc065f344d61effe6c55c3da6 (master) commit 0369e57d0380d6a3ec3bc493df535fa90dc97e78 (release/2.3)
Author: Heiko Hund Date: Wed Nov 25 17:46:49 2015 +0100
put virtual IPv6 addresses into env
Signed-off-by: Heiko Hund <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10613
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering