Skip to contentSkip to conversation

dco.h: fix return type when DCO is not enabled

PATCH Superseded Lev Stipakov 2 participants 4 messages Aug 17, 2022 – Aug 18, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dco.h: fix return type when DCO is not enabled

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

The correct return type for those functions is int, so adjust return type accordingly for the cases when DCO is not defined.

---
 src/openvpn/dco.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/openvpn/dco.h +3 -3
index 6b5c016a..04556471 100644
@@ -292,7 +292,7 @@ dco_update_keys(dco_context_t *dco, struct tls_multi *multi)
     ASSERT(false);
 }
 
-static inline bool
+static inline int
 dco_p2p_add_new_peer(struct context *c)
 {
     return true;
@@ -310,10 +310,10 @@ dco_remove_peer(struct context *c)
 {
 }
 
-static inline bool
+static inline int
 dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi)
 {
-    return true;
+    return 0;
 }
 
 static inline void
Signature · 1 line
2.23.0.windows.1
#1 lore raw

Hi,

Quoted 5 lines · Lev Stipakov

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

The correct return type for those functions is int, so adjust return type accordingly for the cases when DCO is not defined.

The change is fine, but you only go halfway...

Quoted 9 lines
---
 src/openvpn/dco.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/openvpn/dco.h +0 -0
index 6b5c016a..04556471 100644

src/openvpn/dco.h dco_update_keys(dco_context_t *dco, struct tls_multi *multi) · line 298

Quoted 8 lines
src/openvpn/dco.h +1 -1
@@ -292,7 +292,7 @@ dco_update_keys(dco_context_t *dco, struct tls_multi *multi)
     ASSERT(false);
 }
 
-static inline bool
+static inline int
 dco_p2p_add_new_peer(struct context *c)
 {
     return true;

Here, you change bool->int, but leave "return true"...

src/openvpn/dco.h dco_remove_peer(struct context *c) · line 317

Quoted 11 lines
src/openvpn/dco.h +2 -2
@@ -310,10 +310,10 @@ dco_remove_peer(struct context *c)
 {
 }
 
-static inline bool
+static inline int
 dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi)
 {
-    return true;
+    return 0;
 }

... here, you also change the return to "int".

Can we have this consistently? ;-)

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]...
#2 lore raw

PATCH v2 1/1 dco.h: fix return type when DCO is not enabled

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

The correct return type for those functions is int, so adjust return type accordingly for the cases when DCO is not defined.

---
v2: also do "return 0" in dco_p2p_add_new_peer()

 src/openvpn/dco.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/openvpn/dco.h +4 -4
index 6b5c016a..e063853c 100644
@@ -292,10 +292,10 @@ dco_update_keys(dco_context_t *dco, struct tls_multi *multi)
     ASSERT(false);
 }
 
-static inline bool
+static inline int
 dco_p2p_add_new_peer(struct context *c)
 {
-    return true;
+    return 0;
 }
 
 static inline int
@@ -310,10 +310,10 @@ dco_remove_peer(struct context *c)
 {
 }
 
-static inline bool
+static inline int
 dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi)
 {
-    return true;
+    return 0;
 }
 
 static inline void
Signature · 1 line
2.23.0.windows.1
Acked-by on v2 1/1
#3 lore raw

Test compiled on Linux and FreeBSD, just to be sure.

Your patch has been applied to the master branch.

commit 329cb7ed2cb8503e99bed5bf3499f2194536d6ce

Author: Lev Stipakov
Date:   Wed Aug 17 22:12:23 2022 +0200
     dco.h: fix return type when DCO is not enabled

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg24968.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering