mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-05-28 04:03:29 -04:00
Windows: fix unused variables in delete_route_ipv6
At this point it might be easier to create a dedicated function for Windows... Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> Acked-by: Lev Stipakov <lstipakov@gmail.com> Message-Id: <20230203191440.136050-3-frank@lichtenheld.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26140.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
8aeec3aa36
commit
48495ce3cd
1 changed files with 16 additions and 16 deletions
|
|
@ -2333,12 +2333,6 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
|
|||
openvpn_net_ctx_t *ctx)
|
||||
{
|
||||
const char *network;
|
||||
#if !defined(TARGET_LINUX)
|
||||
const char *gateway;
|
||||
#else
|
||||
int metric;
|
||||
#endif
|
||||
bool gateway_needed = false;
|
||||
|
||||
if ((r6->flags & (RT_DEFINED|RT_ADDED)) != (RT_DEFINED|RT_ADDED))
|
||||
{
|
||||
|
|
@ -2346,19 +2340,34 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
|
|||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(TARGET_LINUX)
|
||||
const char *gateway;
|
||||
#else
|
||||
int metric;
|
||||
#endif
|
||||
bool gateway_needed = false;
|
||||
const char *device = tt->actual_name;
|
||||
if (r6->iface != NULL) /* vpn server special route */
|
||||
{
|
||||
device = r6->iface;
|
||||
gateway_needed = true;
|
||||
}
|
||||
|
||||
/* if we used a gateway on "add route", we also need to specify it on
|
||||
* delete, otherwise some OSes will refuse to delete the route
|
||||
*/
|
||||
if (tt->type == DEV_TYPE_TAP
|
||||
&& !( (r6->flags & RT_METRIC_DEFINED) && r6->metric == 0 ) )
|
||||
{
|
||||
gateway_needed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct gc_arena gc = gc_new();
|
||||
struct argv argv = argv_new();
|
||||
|
||||
network = print_in6_addr( r6->network, 0, &gc);
|
||||
#if !defined(TARGET_LINUX)
|
||||
#if !defined(TARGET_LINUX) && !defined(_WIN32)
|
||||
gateway = print_in6_addr( r6->gateway, 0, &gc);
|
||||
#endif
|
||||
|
||||
|
|
@ -2382,15 +2391,6 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
|
|||
|
||||
msg( M_INFO, "delete_route_ipv6(%s/%d)", network, r6->netbits );
|
||||
|
||||
/* if we used a gateway on "add route", we also need to specify it on
|
||||
* delete, otherwise some OSes will refuse to delete the route
|
||||
*/
|
||||
if (tt->type == DEV_TYPE_TAP
|
||||
&& !( (r6->flags & RT_METRIC_DEFINED) && r6->metric == 0 ) )
|
||||
{
|
||||
gateway_needed = true;
|
||||
}
|
||||
|
||||
#if defined(TARGET_LINUX)
|
||||
metric = -1;
|
||||
if ((r6->flags & RT_METRIC_DEFINED) && (r6->metric > 0))
|
||||
|
|
|
|||
Loading…
Reference in a new issue