Add missing environment variables for IPv6 virtual addresses:
* ifconfig_pool_local_ip6
* ifconfig_pool_remote_ip6
* ifconfig_pool_ip6_netbits
Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1448470009-5243-1-git-send-email-heiko.hund@sophos.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10613
Signed-off-by: Gert Doering <gert@greenie.muc.de>
... | ... |
@@ -1506,10 +1506,24 @@ multi_set_virtual_addr_env (struct multi_context *m, struct multi_instance *mi) |
1506 | 1506 |
} |
1507 | 1507 |
} |
1508 | 1508 |
|
1509 |
- /* TODO: I'm not exactly sure what these environment variables are |
|
1510 |
- * used for, but if we have them for IPv4, we should also have |
|
1511 |
- * them for IPv6, no? |
|
1512 |
- */ |
|
1509 |
+ setenv_del (mi->context.c2.es, "ifconfig_pool_local_ip6"); |
|
1510 |
+ setenv_del (mi->context.c2.es, "ifconfig_pool_remote_ip6"); |
|
1511 |
+ setenv_del (mi->context.c2.es, "ifconfig_pool_ip6_netbits"); |
|
1512 |
+ |
|
1513 |
+ if (mi->context.c1.tuntap->ipv6 && mi->context.c2.push_ifconfig_ipv6_defined) |
|
1514 |
+ { |
|
1515 |
+ setenv_in6_addr (mi->context.c2.es, |
|
1516 |
+ "ifconfig_pool_remote", |
|
1517 |
+ &mi->context.c2.push_ifconfig_ipv6_local, |
|
1518 |
+ SA_SET_IF_NONZERO); |
|
1519 |
+ setenv_in6_addr (mi->context.c2.es, |
|
1520 |
+ "ifconfig_pool_local", |
|
1521 |
+ &mi->context.c2.push_ifconfig_ipv6_remote, |
|
1522 |
+ SA_SET_IF_NONZERO); |
|
1523 |
+ setenv_int (mi->context.c2.es, |
|
1524 |
+ "ifconfig_pool_ip6_netbits", |
|
1525 |
+ mi->context.c2.push_ifconfig_ipv6_netbits); |
|
1526 |
+ } |
|
1513 | 1527 |
} |
1514 | 1528 |
|
1515 | 1529 |
/* |
... | ... |
@@ -2620,6 +2620,22 @@ setenv_in_addr_t (struct env_set *es, const char *name_prefix, in_addr_t addr, c |
2620 | 2620 |
} |
2621 | 2621 |
|
2622 | 2622 |
void |
2623 |
+setenv_in6_addr (struct env_set *es, |
|
2624 |
+ const char *name_prefix, |
|
2625 |
+ const struct in6_addr *addr, |
|
2626 |
+ const unsigned int flags) |
|
2627 |
+{ |
|
2628 |
+ if (!IN6_IS_ADDR_UNSPECIFIED (addr) || !(flags & SA_SET_IF_NONZERO)) |
|
2629 |
+ { |
|
2630 |
+ struct openvpn_sockaddr si; |
|
2631 |
+ CLEAR (si); |
|
2632 |
+ si.addr.in6.sin6_family = AF_INET6; |
|
2633 |
+ si.addr.in6.sin6_addr = *addr; |
|
2634 |
+ setenv_sockaddr (es, name_prefix, &si, flags); |
|
2635 |
+ } |
|
2636 |
+} |
|
2637 |
+ |
|
2638 |
+void |
|
2623 | 2639 |
setenv_link_socket_actual (struct env_set *es, |
2624 | 2640 |
const char *name_prefix, |
2625 | 2641 |
const struct link_socket_actual *act, |
... | ... |
@@ -403,6 +403,11 @@ void setenv_in_addr_t (struct env_set *es, |
403 | 403 |
in_addr_t addr, |
404 | 404 |
const unsigned int flags); |
405 | 405 |
|
406 |
+void setenv_in6_addr (struct env_set *es, |
|
407 |
+ const char *name_prefix, |
|
408 |
+ const struct in6_addr *addr, |
|
409 |
+ const unsigned int flags); |
|
410 |
+ |
|
406 | 411 |
void setenv_link_socket_actual (struct env_set *es, |
407 | 412 |
const char *name_prefix, |
408 | 413 |
const struct link_socket_actual *act, |