On Fri, Aug 23, 2019 at 07:33:29PM +0200, Martijn van Duren wrote:
> On 8/23/19 7:06 PM, Gilles Chehade wrote:
> > On Fri, Aug 23, 2019 at 09:03:51AM +0200, Martijn van Duren wrote:
> >> Hello,
> >>
> >
> > Hello,
> >
> >
> >> When running processes with proc-exec any logging send over stderr is
> >> not very intelligible since the process name is automatically generated
> >> and results in <dynproc:%08x>, which make them hard to read.
> >>
> >
> > Agreed
> >
> >
> >> To clean this up I reckon we can do three things:
> >> 1) Add an extra optional proc parameter that sets the name. Diff below
> >> does this.
> >> 2) Change the process name to match the filter name.
> >> 3) Do both
> >>
> >> I reckon we're still early enough in the development process for us to
> >> change the default processor name in proc-exec.
> >>
> >> Thoughts?
> >>
> >
> > I'm unsure about 1- because it really reads cumbersome in my opinion:
> >
> > filter "rspamd" proc-exec proc "rspamd" "/usr/local/bin/filter-rspamd"
> >
> > Option 2- has my preference because it is really what you'd expect out
> > of the box, it was on my todo but if you're looking into it I'd rather
> > let you do it :-)
> >
> >
> I agree.
>
> That would be this diff.
>
> OK?
>
last_dynproc_id is no longer needed ?
nice
> Index: parse.y
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/parse.y,v
> retrieving revision 1.257
> diff -u -p -r1.257 parse.y
> --- parse.y 11 Aug 2019 17:23:12 -0000 1.257
> +++ parse.y 23 Aug 2019 17:33:17 -0000
> @@ -108,7 +108,6 @@ struct rule *rule;
> struct processor *processor;
> struct filter_config *filter_config;
> static uint32_t last_dynchain_id = 1;
> -static uint32_t last_dynproc_id = 1;
>
> enum listen_options {
> LO_FAMILY = 0x000001,
> @@ -1598,12 +1597,6 @@ FILTER STRING PROC STRING {
> }
> |
> FILTER STRING PROC_EXEC STRING {
> - char buffer[128];
> -
> - do {
> - (void)snprintf(buffer, sizeof buffer, "<dynproc:%08x>",
> last_dynproc_id++);
> - } while (dict_check(conf->sc_processors_dict, buffer));
> -
> if (dict_get(conf->sc_filters_dict, $2)) {
> yyerror("filter already exists with that name: %s", $2);
> free($2);
> @@ -1617,7 +1610,7 @@ FILTER STRING PROC_EXEC STRING {
> filter_config = xcalloc(1, sizeof *filter_config);
> filter_config->filter_type = FILTER_TYPE_PROC;
> filter_config->name = $2;
> - filter_config->proc = xstrdup(buffer);
> + filter_config->proc = xstrdup($2);
> dict_set(conf->sc_filters_dict, $2, filter_config);
> } proc_params {
> dict_set(conf->sc_processors_dict, filter_config->proc, processor);
>
--
Gilles Chehade @poolpOrg
https://www.poolp.org patreon: https://www.patreon.com/gilles