moto kawasaki
November 15, 2013 03:38AM
Dear Sirs,

Firstly, I'd like to thank you very much for supplying such powerful
and smart software. nginx is so great.


Now, I am struggling to add "setfib=N" parameter to "server" token in
"upstream" clause, and so far failed.

It is really appreciated if you'd advice/suggest/comment on it.
Thank you very very much in advance.

[my environment]
- FreeBSD 9.2-RELEASE-p0
- www/nginx (ports), which is nginx-1.4.3.

[my intention]
- nginx can listen with setfib.
http://nginx.org/en/docs/http/ngx_http_core_module.html#listen

- but nginx cannot setfib against upstream/server.
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#server

- I'd like to add "setfib" parameter, something like below;

upstream backend {
server 192.168.1.1:8080 max_fails=3 setfib=5; # (a)
} # ^^^^^^^^

[what I did]
- I made a patch (see attached) but it fails with the following
emerge message in nginx-error.log.

[emerg] 3848#0: invalid parameter "setfib=5" in /usr/local/etc/nginx/nginx.conf:18

The line 18 of nginx.conf contains setfib=5 (see (a) above.)

- printf debugging tells me;

(1) This emerg log comes from "invalid" clause in function
ngx_http_upstream_server() at line 4689 of
ngx_http_upstream.c. (line numbers are AFTER applying attached
patch.)

4689 invalid:
4691 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
4692 "invalid parameter \"%V\"", &value[i]);

And it is because "uscf->flags" check failed at l.4649.

4649 if (!(uscf->flags & NGX_HTTP_UPSTREAM_SETFIB)) {
4650 goto invalid;
4651 }

(2) This "uscf->flags" has been set in the function
ngx_http_upstream() at line 4434;

4434 uscf = ngx_http_upstream_add(cf, &u, NGX_HTTP_UPSTREAM_CREATE
4435 |NGX_HTTP_UPSTREAM_WEIGHT
4436 |NGX_HTTP_UPSTREAM_MAX_FAILS
4437 |NGX_HTTP_UPSTREAM_FAIL_TIMEOUT
4438 |NGX_HTTP_UPSTREAM_DOWN
4439 #if (NGX_HAVE_SETFIB)
4440 |NGX_HTTP_UPSTREAM_BACKUP
4441 |NGX_HTTP_UPSTREAM_SETFIB);
4442 #else
4443 |NGX_HTTP_UPSTREAM_BACKUP);
4444 #endif /* NGX_HAVE_SETFIB */

And keep the bit of NGX_HTTP_UPSTREAM_SETFIB as ON, so that the
uscf->flags=127, until just before the function
ngx_conf_parse() called.

4511 rv = ngx_conf_parse(cf, NULL);

Returning from this function, uscf->flags=31, which means the
SETFIB bit is OFF, thus check at l.4649 falls into invalid.

[my questions]

Well, I tried but couldn't find out where that bit being set OFF.
So, please tell me the place or how to preserve it.

Also, please advice me whether my logic above is wrong or not, where I
made a mistake, how to achieve setfib option in upstream/server, etc.



Thank you very much.



Best Regards,


--
moto kawasaki <moto@kawasaki3.org>

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

pls. help for adding another parameter to ngx_upstream_server

moto kawasaki 1234 November 15, 2013 03:38AM

Re: pls. help for adding another parameter to ngx_upstream_server

Vladimir Homutov 443 November 15, 2013 04:44AM

Re: pls. help for adding another parameter to ngx_upstream_server

moto kawasaki 498 November 16, 2013 04:34AM

Re: pls. help for adding another parameter to ngx_upstream_server

Maxim Dounin 489 November 18, 2013 09:10AM

Re: pls. help for adding another parameter to ngx_upstream_server Attachments

moto kawasaki 442 November 26, 2013 11:39AM

Re: pls. help for adding another parameter to ngx_upstream_server

Maxim Dounin 429 November 26, 2013 11:39AM

Re: pls. help for adding another parameter to ngx_upstream_server

moto kawasaki 379 November 26, 2013 09:08PM

Re: pls. help for adding another parameter to ngx_upstream_server

moto kawasaki 544 November 29, 2013 02:06AM

Re: pls. help for adding another parameter to ngx_upstream_server

Maxim Dounin 451 November 15, 2013 05:26AM



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

Online Users

Guests: 301
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