Skip to contentSkip to conversation

Remove unused no-op function

PATCH In review Lev Stipakov 2 participants 2 messages Jul 24, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove unused no-op function

From: Lev Stipakov <[email protected]...>

Body of check_subnet_conflict() was commented out (#if 0) back in 2011, so it is safe now to completely elimitate this function, including all calls to it.

As a bonus, remove unused local variable in do_set_mtu_service().

---
 src/openvpn/route.c |  1 -
 src/openvpn/tun.c   | 48 ---------------------------------------------
 src/openvpn/tun.h   |  4 ----
 3 files changed, 53 deletions(-)
src/openvpn/route.c +0 -1
index b57da5dd..966f6297 100644
@@ -1215,7 +1215,6 @@ add_routes(struct route_list *rl, struct route_ipv6_list *rl6,
 
         for (r = rl->routes; r; r = r->next)
         {
-            check_subnet_conflict(r->network, r->netmask, "route");
             if (flags & ROUTE_DELETE_FIRST)
             {
                 delete_route(r, tt, flags, &rl->rgi, es, ctx);
src/openvpn/tun.c +0 -48

66 lines not on this page · raw message

src/openvpn/tun.h +0 -4
index 99826cf7..e73be206 100644
@@ -309,10 +309,6 @@ const char *ifconfig_options_string(const struct tuntap *tt, bool remote, bool d
 
 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);
 
 /*
Signature · 1 line
2.17.1
#1 lore raw

Hi,

Quoted 5 lines · Lev Stipakov

From: Lev Stipakov <[email protected]...>

Body of check_subnet_conflict() was commented out (#if 0) back in 2011, so it is safe now to completely elimitate this function, including all calls to it.

I'm a bit sceptical about that one. Can we make it *work* instead?

It's a good idea, and I've seen support calls with "hey, openvpn is not working, why?" due to RFC address conflict - so having an indication in the log might be helpful.

I agree that with "#if 0" this is just dead code.

Any indication in the commit why it was commented out? Not working right?

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...