[Openvpn-devel,1/7] networking: remove duplicate methods from networking_sitnl.c

Message ID 20220402070902.30282-2-a@unstable.cc
State Accepted
Headers show
Series Introduce ovpn-dco(-win) support | expand

Commit Message

Antonio Quartulli April 1, 2022, 8:08 p.m. UTC
From: Arne Schwabe <arne@rfc2549.org>

The net_ctx_init/reset/free methods of sitnl are the same dummy
methods that are already defined for non-Linux platforms in the
networking.h header.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 src/openvpn/networking.h       |  7 ++++++-
 src/openvpn/networking_sitnl.c | 22 ----------------------
 2 files changed, 6 insertions(+), 23 deletions(-)

Comments

Gert Doering April 3, 2022, 4:45 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Trivial enough.  Compile-tested with sitnl and --enable-iproute2.

Your patch has been applied to the master branch.

commit c0fa37eda2a12c6587e9b2db2c0a33c91d3ced6e
Author: Arne Schwabe
Date:   Sat Apr 2 09:08:56 2022 +0200

     networking: remove duplicate methods from networking_sitnl.c

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220402070902.30282-2-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24054.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/networking.h b/src/openvpn/networking.h
index 4e7610ec..2cbf6163 100644
--- a/src/openvpn/networking.h
+++ b/src/openvpn/networking.h
@@ -33,7 +33,12 @@  struct context;
 /* define mock types to ensure code builds on any platform */
 typedef void *openvpn_net_ctx_t;
 typedef void *openvpn_net_iface_t;
+#endif /* ifdef ENABLE_SITNL */
 
+/* Only the iproute2 backend implements these functions,
+ * the rest can rely on these stubs
+ */
+#if !defined(ENABLE_IPROUTE)
 static inline int
 net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)
 {
@@ -51,7 +56,7 @@  net_ctx_free(openvpn_net_ctx_t *ctx)
 {
     (void)ctx;
 }
-#endif /* ifdef ENABLE_SITNL */
+#endif /* !defined(ENABLE_IPROUTE) */
 
 #if defined(ENABLE_SITNL) || defined(ENABLE_IPROUTE)
 
diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c
index 515a30d6..9b2f58d9 100644
--- a/src/openvpn/networking_sitnl.c
+++ b/src/openvpn/networking_sitnl.c
@@ -596,28 +596,6 @@  net_route_v6_best_gw(openvpn_net_ctx_t *ctx, const struct in6_addr *dst,
 }
 
 #ifdef ENABLE_SITNL
-
-int
-net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)
-{
-    (void)c;
-    (void)ctx;
-
-    return 0;
-}
-
-void
-net_ctx_reset(openvpn_net_ctx_t *ctx)
-{
-    (void)ctx;
-}
-
-void
-net_ctx_free(openvpn_net_ctx_t *ctx)
-{
-    (void)ctx;
-}
-
 int
 net_route_v4_best_gw(openvpn_net_ctx_t *ctx, const in_addr_t *dst,
                      in_addr_t *best_gw, char *best_iface)