]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
* polished redirect-gateway (ipv4 on ipv6 endpoints) support
authorJuanJo Ciarlante <jjo@google.com>
Wed, 11 Nov 2009 14:35:31 +0000 (15:35 +0100)
committerJuanJo Ciarlante <juanjosec@gmail.com>
Fri, 25 Mar 2011 12:30:30 +0000 (13:30 +0100)
route.c
socket.c
socket.h

diff --git a/route.c b/route.c
index f3ed974cdef360f26f7803ba2d317d9420574cb6..cf10334045e903c6f02b17b390c2dbfbbf8d2aa8 100644 (file)
--- a/route.c
+++ b/route.c
@@ -581,7 +581,7 @@ redirect_default_route_to_vpn (struct route_list *rl, const struct tuntap *tt, u
          if (!local)
            {
              /* route remote host to original default gateway */
-             if (rl->spec.remote_host != 0xffffffff) {
+             if (rl->spec.remote_host != IPV4_INVALID_ADDR) {
                add_route3 (rl->spec.remote_host,
                            ~0,
                            rl->spec.net_gateway,
index 2d46d3f338d948db65b2d847f4169afa49171808..72da7927f2aa5dca480d024e8a75237b313c232c 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -2147,7 +2147,7 @@ link_socket_current_remote (const struct link_socket_info *info)
  */
 #ifdef USE_PF_INET6
   if (lsa->actual.dest.addr.sa.sa_family != AF_INET)
-    return 0xffffffff;
+    return IPV4_INVALID_ADDR;
 #else
   ASSERT (lsa->actual.dest.addr.sa.sa_family == AF_INET);
 #endif
index f864ab198477ee511e2421c44601dd60b4ec6142..5f1e800ae3217f1f25a6375bab6fafd85af88638 100644 (file)
--- a/socket.h
+++ b/socket.h
@@ -383,6 +383,12 @@ void setenv_link_socket_actual (struct env_set *es,
 
 void bad_address_length (int actual, int expected);
 
+#ifdef USE_PF_INET6
+/* IPV4_INVALID_ADDR: returned by link_socket_current_remote()
+ * to ease redirect-gateway logic for ipv4 tunnels on ipv6 endpoints
+ */
+#define IPV4_INVALID_ADDR 0xffffffff
+#endif
 in_addr_t link_socket_current_remote (const struct link_socket_info *info);
 
 void link_socket_connection_initiated (const struct buffer *buf,