NGX_STREAM_UPS_CONF handling

Benjamin Coddington bcodding at redhat.com
Thu Oct 21 16:20:21 UTC 2021


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?

Ben



More information about the nginx-devel mailing list