From: "flichtenheld (Code Review)" Date: Tue, 14 Jan 2025 13:14:14 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="3D0QBMjEMts="; 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: plaisthos Cc: openvpn-devel --3D0QBMjEMts= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/863?usp=3Demail to review the following change. 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 --- M src/openvpn/route.c M src/openvpn/tun.c M src/openvpn/tun.h 3 files changed, 0 insertions(+), 52 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/863/1 diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 278233f..b8ede01 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 9dce8da..3f2ec4a 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 a5b9a48..911e58b 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: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange --3D0QBMjEMts= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

Vi= ew 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 Licht= enheld <frank@...2641...>
---
M src/openvpn/route.c
M src/op= envpn/tun.c
M src/openvpn/tun.h
3 files changed, 0 insertions(+), 52 = deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs=
/changes/63/863/1
diff --git a/src/openvpn/route.c b/src/openvpn/ro=
ute.c
index 278233f..b8ede01 100644
--- a/s= rc/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -1218,7 +1218,6 @@

for (r = =3D rl->routes; r; r =3D r->next)
{- check_subnet_confl= ict(r->network, r->netmask, "route");
= if (flags & ROUTE_DELETE_FIRST)
{<= /span>
delete_route(r, tt, flags, &rl->rgi= , es, ctx);
diff --git a/src/openvpn/tun.c b/src/openvpn/tu= n.c
index 9dce8da..3f2ec4a 100644
--- a/src= /openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -= 626,44 +626,6 @@
gc_free(&gc);
}<= /span>

-/*
- * Issue a warning if i= p/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 19= 2.168.1.x.
- */<= br>-void
-check_subnet_conflict(const in_addr_t ip,

- cons= t 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;<= br>-
- 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 sub= nets defined by network/netmask and lan_network/lan_netmask intersect? */
- if ((network &a= mp; lan_netmask) =3D=3D lan_network
- || (lan_network & netmask) =3D=3D network)
- {
- msg(M_WARN, "WARNIN= G: potential %s subnet conflict 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(network, 0, &gc),
- print_in_addr_t(netmask, 0, &gc))= ;
- }
= - }
- gc_free(&gc);
-#endif /* if 0 */
-}
-
- if (!tun_p2p)
- {
- check_subnet_conflict(tt->local= , tt->remote_netmask, "TUN/TAP adapter");
- }
- else
- {
- check_subnet_conflict(tt->local, IPV4_NETMAS= K_HOST, "TUN/TAP adapter");
- }
}
<= /span>
#ifdef _WIN32
diff --git a/src/openvpn/tun= .h b/src/openvpn/tun.h
index a5b9a48..911e58b 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 change 863. To unsubsc= ribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If570253e57371e4126b0e8aa4c3= 49e2051cb8b00
Gerrit-Change-Number: 863
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-MessageType: newchange
--3D0QBMjEMts=--