Hi

On Fri, Nov 5, 2021 at 12:14 PM Arne Schwabe <a...@rfc2549.org> wrote:

> This put the early initialisation and uninitialisation that needs to
> happen between option parsing and post processing into small methods.
>
> Signed-off-by: Arne Schwabe <a...@rfc2549.org>
> ---
>  src/openvpn/openvpn.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c
> index 0ac961429..05b5dc2d0 100644
> --- a/src/openvpn/openvpn.c
> +++ b/src/openvpn/openvpn.c
> @@ -105,6 +105,20 @@ tunnel_point_to_point(struct context *c)
>
>  #undef PROCESS_SIGNAL_P2P
>
> +void init_early(struct context *c)
> +{
> +    net_ctx_init(c, c->net_ctx);
>

hmm... this should have been &c->net_ctx. Can this be fixed during commit?
The rest looks good.


> +
> +    /* init verbosity and mute levels */
> +    init_verb_mute(c, IVM_LEVEL_1);
> +
> +}
> +
> +static void uninit_early(struct context *c)
> +{
> +    net_ctx_free(&c->net_ctx);
> +}
> +
>
>
>  /**************************************************************************/
>  /**
> @@ -193,10 +207,9 @@ openvpn_main(int argc, char *argv[])
>              open_plugins(&c, true, OPENVPN_PLUGIN_INIT_PRE_CONFIG_PARSE);
>  #endif
>
> -            net_ctx_init(&c, &c.net_ctx);
> -
> -            /* init verbosity and mute levels */
> -            init_verb_mute(&c, IVM_LEVEL_1);
> +            /* Early initialisation that need to happen before option
> +             * post processing and other early startup but after parsing
> */
> +            init_early(&c);
>
>              /* set dev options */
>              init_options_dev(&c.options);
> @@ -308,7 +321,7 @@ openvpn_main(int argc, char *argv[])
>              env_set_destroy(c.es);
>              uninit_options(&c.options);
>              gc_reset(&c.gc);
> -            net_ctx_free(&c.net_ctx);
> +            uninit_early(&c);
>          }
>          while (c.sig->signal_received == SIGHUP);
>      }
> --
> 2.33.0
>
>
>
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to