[Openvpn-devel] dco.h: fix return type when DCO is not enabled

Message ID 20220817110319.195-1-lstipakov@gmail.com
State Superseded
Headers show
Series [Openvpn-devel] dco.h: fix return type when DCO is not enabled | expand

Commit Message

Lev Stipakov Aug. 17, 2022, 1:03 a.m. UTC
From: Lev Stipakov <lev@openvpn.net>

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

Signed-off-by: Lev Stipakov <lev@openvpn.net>
---
 src/openvpn/dco.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Gert Doering Aug. 17, 2022, 4:58 a.m. UTC | #1
Hi,

On Wed, Aug 17, 2022 at 01:03:19PM +0200, Lev Stipakov wrote:
> From: Lev Stipakov <lev@openvpn.net>
> 
> 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...

> ---
>  src/openvpn/dco.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/openvpn/dco.h b/src/openvpn/dco.h
> index 6b5c016a..04556471 100644
> --- a/src/openvpn/dco.h
> +++ b/src/openvpn/dco.h
> @@ -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"...

> @@ -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

Patch

diff --git a/src/openvpn/dco.h b/src/openvpn/dco.h
index 6b5c016a..04556471 100644
--- a/src/openvpn/dco.h
+++ b/src/openvpn/dco.h
@@ -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