Welcome! Log In Create A New Profile

Advanced

Re: NGX_STREAM_UPS_CONF handling

Maxim Dounin
October 21, 2021 09:42PM
Hello!

On Thu, Oct 21, 2021 at 12:20:21PM -0400, Benjamin Coddington wrote:

> Hi devs, I'm new here, be gentle.
>
> I'm hacking up a tls offloading proxy for sunrpc, getting up to speed on
> nginx codebase, but I'm sinking too much time into figuring something:
>
> I'd like to use a flag configuration directive within an upstream config
> stanza:
>
> static ngx_command_t
> ngx_stream_rpc_tls_commands[] = {
>
> { ngx_string("rpc_tls_client"),
> NGX_STREAM_SRV_CONF|NGX_STREAM_UPS_CONF|NGX_CONF_FLAG,
> ngx_conf_set_flag_slot,
> NGX_STREAM_SRV_CONF_OFFSET,
> offsetof(ngx_stream_rpc_tls_conf_t, client),
> NULL },
>
> ngx_null_command
> };
>
> .. but when I go to merge server configs, the value is always unset. The
> debugger showed me that the upstream module does its own pass at
>
> module->create_srv_conf
>
> and
>
> ngx_conf_parse()
>
> so the configuration, while set, isn't there in my merge server config
> function, it's somewhere else and I'm not sure how to access it.
>
> I'm at the point where it feels like I'm "doing it wrong". What's the
> correct way to have both NGX_STREAM_SRV_CONF|NGX_CONF_FLAG and
> NGX_STREAM_SRV_CONF|NGX_STREAM_UPS_CONF|NGX_CONF_FLAG directives in the same
> module that can be handled by the same module's configuration?

The upstream{} block is a separate entity which isn't subject for
configuration merging. Any initialization is expected to be
handled in the uscf->peer.init_upstream handler, as set by
balancers and called by the ngx_stream_upstream_init_main_conf().

For examples on how to use it, check various balancers code. In
particular, ngx_http_upstream_keepalive_module might be
interesting, as it provides several configuration directives.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

NGX_STREAM_UPS_CONF handling

Benjamin Coddington 276 October 21, 2021 12:22PM

Re: NGX_STREAM_UPS_CONF handling

Maxim Dounin 136 October 21, 2021 09:42PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 299
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready