From: "cron2 (Code Review)" Date: Sun, 9 Mar 2025 17:01:55 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <6afe9e21d1c056bc84a38d2372e6e580f9bd68a8-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="1a5EA0N/yrc="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Remove unused function check_subnet_conflict List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --1a5EA0N/yrc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/86= 3?usp=3Demail ) Change subject: Remove unused function check_subnet_conflict ...................................................................... Remove unused function check_subnet_conflict This has been #if 0 for over a decade. Let's just remove this. Change-Id: If570253e57371e4126b0e8aa4c349e2051cb8b00 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20250309165500.21796-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 083.html Signed-off-by: Gert Doering --- M src/openvpn/route.c M src/openvpn/tun.c M src/openvpn/tun.h 3 files changed, 0 insertions(+), 52 deletions(-) diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 245b15b..dbdc01d 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1218,7 +1218,6 @@ for (r =3D rl->routes; r; r =3D r->next) { - check_subnet_conflict(r->network, r->netmask, "route"); if (flags & ROUTE_DELETE_FIRST) { delete_route(r, tt, flags, &rl->rgi, es, ctx); diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 4817f45..de54e89 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -626,44 +626,6 @@ gc_free(&gc); } -/* - * Issue a warning if ip/netmask (on the virtual IP network) conflicts with - * the settings on the local LAN. This is designed to flag issues where - * (for example) the OpenVPN server LAN is running on 192.168.1.x, but then - * an OpenVPN client tries to connect from a public location that is also = running - * off of a router set to 192.168.1.x. - */ -void -check_subnet_conflict(const in_addr_t ip, - const in_addr_t netmask, - const char *prefix) -{ -#if 0 /* too many false positives */ - struct gc_arena gc =3D gc_new(); - in_addr_t lan_gw =3D 0; - in_addr_t lan_netmask =3D 0; - - if (get_default_gateway(&lan_gw, &lan_netmask) && lan_netmask) - { - const in_addr_t lan_network =3D lan_gw & lan_netmask; - const in_addr_t network =3D ip & netmask; - - /* do the two subnets defined by network/netmask and lan_network/l= an_netmask intersect? */ - if ((network & lan_netmask) =3D=3D lan_network - || (lan_network & netmask) =3D=3D network) - { - msg(M_WARN, "WARNING: potential %s subnet conflict between loc= al LAN [%s/%s] and remote VPN [%s/%s]", - prefix, - print_in_addr_t(lan_network, 0, &gc), - print_in_addr_t(lan_netmask, 0, &gc), - print_in_addr_t(network, 0, &gc), - print_in_addr_t(netmask, 0, &gc)); - } - } - gc_free(&gc); -#endif /* if 0 */ -} - void warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx) { @@ -922,15 +884,6 @@ tt->remote_netmask); } } - - if (!tun_p2p) - { - check_subnet_conflict(tt->local, tt->remote_netmask, "TUN/= TAP adapter"); - } - else - { - check_subnet_conflict(tt->local, IPV4_NETMASK_HOST, "TUN/T= AP adapter"); - } } #ifdef _WIN32 diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index ccba0bc..b616f5d 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -355,10 +355,6 @@ bool is_tun_p2p(const struct tuntap *tt); -void check_subnet_conflict(const in_addr_t ip, - const in_addr_t netmask, - const char *prefix); - void warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx); /** -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/863?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: If570253e57371e4126b0e8aa4c349e2051cb8b00 Gerrit-Change-Number: 863 Gerrit-PatchSet: 5 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --1a5EA0N/yrc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Remove unused function check_subnet_conflict
This has been #if 0 for over a decade. Let's just
remove this.=

Change-Id: If570253e57371e4126b0e8aa4c349e2051cb8b00
Signed-off-= by: Frank Lichtenheld <frank@...2641...>
Acked-by: Gert Doering &l= t;gert@...1296...>
Message-Id: <20250309165500.21796-1-gert@...1826...= 6...>
URL: https://www.mail-archive.com/openvpn-devel@...1768...= ge.net/msg31083.html
Signed-off-by: Gert Doering <gert@...1296...>=
---
M src/openvpn/route.c
M src/openvpn/tun.c
M src/openvpn/tu= n.h
3 files changed, 0 insertions(+), 52 deletions(-)

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
i= ndex 245b15b..dbdc01d 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -1218,7 +1218,6 @@=

for (r =3D rl->routes; r; r = =3D r->next)
{
- check_subnet_conflict(r->network, r->= ;netmask, "route");
if (flags & = ROUTE_DELETE_FIRST)
{
= delete_route(r, tt, flags, &rl->rgi, es, ctx);
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c

inde= x 4817f45..de54e89 100644
--- a/src/openvpn/tun.c+++ b/src/openvpn/tun.c
@@ -626,44 +626,6 @@<= br> gc_free(&gc);
}
=
-/*
- * Issue a warning if ip/netmask (on the virtua= l IP network) conflicts with
- * the settings on the local LAN. This is designed to flag issues w= here
- * (for example) = the OpenVPN server LAN is running on 192.168.1.x, but then
- * an OpenVPN client tries to connect = from a public location that is also running
- * off of a router set to 192.168.1.x.
- */
-void
-check_subnet_conflict(const in_addr_t ip,
- const in_addr_t netmask,

- cons= t char *prefix)
-{
-#if 0 /* too many false po= sitives */
- struct = gc_arena gc =3D gc_new();
- in_addr_t lan_gw =3D 0;
- in_addr_t lan_netmask =3D 0;
-
-= if (get_default_gateway(&lan_gw, &lan_netmask) && lan_n= etmask)
- {- const in_addr_t lan_ne= twork =3D lan_gw & lan_netmask;
- const in_addr_t network =3D ip & netmask;<= br>-
- /* do the two subnets defined by network/n= etmask and lan_network/lan_netmask intersect? */
- if ((network & lan_netmask) =3D=3D l= an_network
- = || (lan_network & netmask) =3D=3D network)
- {
- msg(M_WARN, "WARNING: potential %s subnet co= nflict between local LAN [%s/%s] and remote VPN [%s/%s]",
- prefix,

= - print_in_addr_t(= lan_network, 0, &gc),
- print_in_addr_t(lan_netmask, 0, &gc),
- print_in_addr_t(net= work, 0, &gc),
- = print_in_addr_t(netmask, 0, &gc));
- }
- }
- gc_free(&gc);
-#endif /* if 0 */
-= }
-
vo= id
warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx)
{
@@ -922,15 +884,6 @@
= tt->remote_netmask);
= }
}
-
- if (!tun_p2p)
- {
- check_subnet_conflict(tt->local, tt->remote_netmask= , "TUN/TAP adapter");
- }
- else
- = {
- = check_subnet_conflict(tt->local, IPV4_NETMASK_HOST, "TUN/TAP a= dapter");
- = }
}

#ifdef= _WIN32
diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h<= /span>
index ccba0bc..b616f5d 100644
--- a/src/ope= nvpn/tun.h
+++ b/src/openvpn/tun.h
@@ -355,= 10 +355,6 @@

bool is_tun_p2p(const struc= t tuntap *tt);

-void check_subnet_conflict(const in_addr_t ip,
- const in_add= r_t netmask,
- = const char *prefix);
-
void warn_on_use_of_common_subnets(openv= pn_net_ctx_t *ctx);

/**
=

To view, visit change 863. To unsubscribe, or for help writi= ng mail filters, visit setti= ngs.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If570253e57371e4126b0e8aa4c3= 49e2051cb8b00
Gerrit-Change-Number: 863
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--1a5EA0N/yrc=--