-
-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Describe the bug
While applying all the patches provided by openresty for 1.27.1 to version 1.29.0 (because there are no newer ones), the patch nginx-1.27.1-stream_proxy_protocol_v2.patch break the build process.
The example pipeline shows the following error related to the mail module:
[...]
#9 109.7 -o objs/src/mail/ngx_mail_smtp_handler.o \
#9 109.7 src/mail/ngx_mail_smtp_handler.c
#9 110.0 cc -c -I/usr/local/include/luajit-2.1 -I/usr/local/include/luajit-2.1 -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=2 -fPIC -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_UPSTREAM_LIST -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I /lua-nginx-module-0.10.28/src/api -I /ngx_devel_kit-0.3.4/objs -I objs/addon/ndk -I /stream-lua-nginx-module-a9addfabbf277eb3d1ec77d45e40a324d67022af/src/api -I /usr/include/libxml2 -I objs -I src/mail \
#9 110.0 -o objs/src/mail/ngx_mail_auth_http_module.o \
#9 110.0 src/mail/ngx_mail_auth_http_module.c
#9 110.4 cc -c -I/usr/local/include/luajit-2.1 -I/usr/local/include/luajit-2.1 -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=2 -fPIC -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_UPSTREAM_LIST -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I /lua-nginx-module-0.10.28/src/api -I /ngx_devel_kit-0.3.4/objs -I objs/addon/ndk -I /stream-lua-nginx-module-a9addfabbf277eb3d1ec77d45e40a324d67022af/src/api -I /usr/include/libxml2 -I objs -I src/mail \
#9 110.4 -o objs/src/mail/ngx_mail_proxy_module.o \
#9 110.4 src/mail/ngx_mail_proxy_module.c
#9 110.6 src/mail/ngx_mail_proxy_module.c: In function 'ngx_mail_proxy_send_proxy_protocol':
#9 110.6 src/mail/ngx_mail_proxy_module.c:906:9: error: too few arguments to function 'ngx_proxy_protocol_write'
#9 110.6 906 | p = ngx_proxy_protocol_write(s->connection, buf,
#9 110.6 | ^~~~~~~~~~~~~~~~~~~~~~~~
#9 110.6 In file included from src/core/ngx_core.h:98,
#9 110.6 from src/mail/ngx_mail_proxy_module.c:9:
#9 110.6 src/core/ngx_proxy_protocol.h:31:9: note: declared here
#9 110.6 31 | u_char *ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf,
#9 110.6 | ^~~~~~~~~~~~~~~~~~~~~~~~
#9 110.6 make[2]: *** [objs/Makefile:2229: objs/src/mail/ngx_mail_proxy_module.o] Error 1
#9 110.6 make[2]: Leaving directory '/nginx-1.29.0'
#9 110.6 make[1]: *** [Makefile:10: build] Error 2
#9 110.6 make[1]: Leaving directory '/nginx-1.29.0'
#9 110.6 make: *** [Makefile:53: core] Error 2
It seems that messes with the definitions in src/core/ngx_proxy_protocol.h adding a 4th param that the code doesn't expect to provide.
From the original:
u_char *ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf, u_char *last);to the patched:
u_char *ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf, u_char *last, ngx_uint_t pp_version)Most likely it is not happening on openresty because the mail modules are disabled, so it doesn't cover the faulty code:
--without-mail_pop3_module
--without-mail_imap_module
--without-mail_smtp_module
Also, the patch has been introduced recently only for version 1.27.1 (currently the latest supported by openresty): openresty/openresty@5fdebe7
To Reproduce
Adjust the following in the file src/Makefile in the variable SKIPPED_PATCHES (around line 22). From:
SKIPPED_PATCHES=" \
patches/nginx-1.27.1-stream_proxy_protocol_v2.patch \
"to:
SKIPPED_PATCHES=""Expected behavior
The build goes smoothly without error, with the patched code.