Ticket #230: openvpn-ipv6-environment-variables.patch

File openvpn-ipv6-environment-variables.patch, 2.6 KB (added by kybermonty, 11 years ago)
  • src/openvpn/multi.c

    diff -Naur openvpn-2.3.2/src/openvpn/multi.c openvpn/src/openvpn/multi.c
    old new  
    14001400  setenv_del (mi->context.c2.es, "ifconfig_pool_remote_ip");
    14011401  setenv_del (mi->context.c2.es, "ifconfig_pool_netmask");
    14021402
     1403  setenv_del (mi->context.c2.es, "ifconfig_pool_local_ip6");
     1404  setenv_del (mi->context.c2.es, "ifconfig_pool_remote_ip6");
     1405
    14031406  if (mi->context.c2.push_ifconfig_defined)
    14041407    {
    14051408      const int tunnel_type = TUNNEL_TYPE (mi->context.c1.tuntap);
     
    14261429        }
    14271430    }
    14281431
    1429     /* TODO: I'm not exactly sure what these environment variables are
    1430      *       used for, but if we have them for IPv4, we should also have
    1431      *       them for IPv6, no?
    1432      */
     1432  if (mi->context.c2.push_ifconfig_ipv6_defined)
     1433    {
     1434      setenv_in6_addr (mi->context.c2.es,
     1435                        "ifconfig_pool_remote",
     1436                        &mi->context.c2.push_ifconfig_ipv6_local,
     1437                        SA_SET_IF_NONZERO);
     1438
     1439      setenv_in6_addr (mi->context.c2.es,
     1440                        "ifconfig_pool_local",
     1441                        &mi->context.c2.push_ifconfig_ipv6_remote,
     1442                        SA_SET_IF_NONZERO);
     1443    }
    14331444}
    14341445
    14351446/*
  • src/openvpn/socket.c

    diff -Naur openvpn-2.3.2/src/openvpn/socket.c openvpn/src/openvpn/socket.c
    old new  
    24092409}
    24102410
    24112411void
     2412setenv_in6_addr (struct env_set *es, const char *name_prefix, struct in6_addr *addr, const unsigned int flags)
     2413{
     2414  if (addr || !(flags & SA_SET_IF_NONZERO))
     2415    {
     2416      struct openvpn_sockaddr si;
     2417      CLEAR (si);
     2418      si.addr.in6.sin6_family = AF_INET6;
     2419      memcpy(&si.addr.in6.sin6_addr, addr, sizeof(struct in6_addr));
     2420      memcpy(&si.addr.sa, &si.addr.in6, sizeof(struct sockaddr_in6));
     2421      setenv_sockaddr (es, name_prefix, &si, flags);
     2422    }
     2423}
     2424
     2425void
    24122426setenv_link_socket_actual (struct env_set *es,
    24132427                           const char *name_prefix,
    24142428                           const struct link_socket_actual *act,
  • src/openvpn/socket.h

    diff -Naur openvpn-2.3.2/src/openvpn/socket.h openvpn/src/openvpn/socket.h
    old new  
    383383                       in_addr_t addr,
    384384                       const unsigned int flags);
    385385
     386void setenv_in6_addr (struct env_set *es,
     387                       const char *name_prefix,
     388                       struct in6_addr *addr,
     389                       const unsigned int flags);
     390
    386391void setenv_link_socket_actual (struct env_set *es,
    387392                                const char *name_prefix,
    388393                                const struct link_socket_actual *act,