From 9d4c64b584173789780431e5fd5acf977cf72e9d Mon Sep 17 00:00:00 2001 From: JuanJo Ciarlante Date: Wed, 11 Nov 2009 15:35:31 +0100 Subject: [PATCH] * polished redirect-gateway (ipv4 on ipv6 endpoints) support --- route.c | 2 +- socket.c | 2 +- socket.h | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/route.c b/route.c index f3ed974cd..cf1033404 100644 --- 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, diff --git a/socket.c b/socket.c index 2d46d3f33..72da7927f 100644 --- 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 diff --git a/socket.h b/socket.h index f864ab198..5f1e800ae 100644 --- 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, -- 2.47.3