Skip to content

Commit aac88a3

Browse files
committed
changes from feedback
1 parent 58e9c34 commit aac88a3

File tree

5 files changed

+17
-43
lines changed

5 files changed

+17
-43
lines changed

sapi/fpm/config.m4

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -396,23 +396,6 @@ AC_DEFUN([AC_FPM_TIMES],
396396
])
397397
])
398398

399-
AC_DEFUN([AC_FPM_SOCKETROUTE],
400-
[
401-
have_socketroute=no
402-
AC_MSG_CHECKING([for SO_SETFIB])
403-
404-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[int x = SO_SETFIB;]])], [
405-
have_socketroute=yes
406-
AC_MSG_RESULT([yes])
407-
], [
408-
AC_MSG_RESULT([no])
409-
])
410-
411-
if test $have_socketroute = "yes"; then
412-
AC_DEFINE([HAVE_SOCKETROUTE], 1, [do we have socket route capabilities])
413-
fi
414-
])
415-
416399
AC_DEFUN([AC_FPM_KQUEUE],
417400
[
418401
AC_MSG_CHECKING([for kqueue])
@@ -556,7 +539,6 @@ if test "$PHP_FPM" != "no"; then
556539
AC_FPM_LQ
557540
AC_FPM_SYSCONF
558541
AC_FPM_TIMES
559-
AC_FPM_SOCKETROUTE
560542
AC_FPM_KQUEUE
561543
AC_FPM_PORT
562544
AC_FPM_DEVPOLL

sapi/fpm/fpm/fpm_conf.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ struct fpm_global_config_s fpm_global_config = {
7070
#ifdef HAVE_SYSTEMD
7171
.systemd_watchdog = 0,
7272
.systemd_interval = -1, /* -1 means not set */
73-
#endif
74-
#ifdef HAVE_SOCKETROUTE
75-
.socketroute = -1, /* -1 means not set */
7673
#endif
7774
.log_buffering = ZLOG_DEFAULT_BUFFERING,
7875
.log_limit = ZLOG_DEFAULT_LIMIT
@@ -107,9 +104,6 @@ static struct ini_value_parser_s ini_fpm_global_options[] = {
107104
{ "events.mechanism", &fpm_conf_set_string, GO(events_mechanism) },
108105
#ifdef HAVE_SYSTEMD
109106
{ "systemd_interval", &fpm_conf_set_time, GO(systemd_interval) },
110-
#endif
111-
#ifdef HAVE_SOCKETROUTE
112-
{ "socket.route", &fpm_conf_set_integer, GO(socketroute) },
113107
#endif
114108
{ 0, 0, 0 }
115109
};
@@ -131,6 +125,9 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = {
131125
{ "listen.group", &fpm_conf_set_string, WPO(listen_group) },
132126
{ "listen.mode", &fpm_conf_set_string, WPO(listen_mode) },
133127
{ "listen.allowed_clients", &fpm_conf_set_string, WPO(listen_allowed_clients) },
128+
#ifdef SO_SETFIB
129+
{ "listen.setfib", &fpm_conf_set_integer, WPO(listen_setfib) },
130+
#endif
134131
{ "process.priority", &fpm_conf_set_integer, WPO(process_priority) },
135132
{ "process.dumpable", &fpm_conf_set_boolean, WPO(process_dumpable) },
136133
{ "pm", &fpm_conf_set_pm, WPO(pm) },
@@ -1721,6 +1718,9 @@ static void fpm_conf_dump(void) /* {{{ */
17211718
zlog(ZLOG_NOTICE, "\tlisten.group = %s", STR2STR(wp->config->listen_group));
17221719
zlog(ZLOG_NOTICE, "\tlisten.mode = %s", STR2STR(wp->config->listen_mode));
17231720
zlog(ZLOG_NOTICE, "\tlisten.allowed_clients = %s", STR2STR(wp->config->listen_allowed_clients));
1721+
#ifdef HAVE_SETFIB
1722+
zlog(ZLOG_NOTICE, "\tlisten.setfib = %d", wp->config->listen_setfib);
1723+
#endif
17241724
if (wp->config->process_priority == 64) {
17251725
zlog(ZLOG_NOTICE, "\tprocess.priority = undefined");
17261726
} else {

sapi/fpm/fpm/fpm_conf.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ struct fpm_global_config_s {
4444
int systemd_watchdog;
4545
int systemd_interval;
4646
#endif
47-
#ifdef HAVE_SOCKETROUTE
48-
int socketroute;
49-
#endif
5047
};
5148

5249
extern struct fpm_global_config_s fpm_global_config;
@@ -106,6 +103,9 @@ struct fpm_worker_pool_config_s {
106103
char *listen_acl_users;
107104
char *listen_acl_groups;
108105
#endif
106+
#ifdef SO_SETFIB
107+
int listen_setfib;
108+
#endif
109109
};
110110

111111
struct ini_value_parser_s {

sapi/fpm/fpm/fpm_sockets.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,19 +254,17 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct
254254
return -1;
255255
}
256256

257-
#ifdef HAVE_SOCKETROUTE
258-
if (-1 < fpm_global_config.socketroute) {
259257
#ifdef SO_SETFIB
260-
if (routemax < fpm_global_config.socketroute) {
261-
zlog(ZLOG_ERROR, "Invalid routing table id %d, max is %d", fpm_global_config.socketroute, routemax);
258+
if (-1 < wp->config->listen_setfib) {
259+
if (routemax < wp->config->listen_setfib) {
260+
zlog(ZLOG_ERROR, "Invalid routing table id %d, max is %d", wp->config->listen_setfib, routemax);
262261
close(sock);
263262
return -1;
264263
}
265264

266-
if (0 > setsockopt(sock, SOL_SOCKET, SO_SETFIB, &fpm_global_config.socketroute, sizeof(fpm_global_config.socketroute))) {
265+
if (0 > setsockopt(sock, SOL_SOCKET, SO_SETFIB, &wp->config->listen_setfib, sizeof(wp->config->listen_setfib))) {
267266
zlog(ZLOG_WARNING, "failed to change socket attribute");
268267
}
269-
#endif
270268
}
271269
#endif
272270

@@ -406,10 +404,9 @@ static int fpm_socket_af_unix_listening_socket(struct fpm_worker_pool_s *wp) /*
406404
}
407405
/* }}} */
408406

409-
#ifdef HAVE_SOCKETROUTE
410-
static zend_result fpm_socket_setroute_init(void) /* {{{ */
411-
{
412407
#ifdef SO_SETFIB
408+
static zend_result fpm_socket_setfib_init(void) /* {{{ */
409+
{
413410
/* potentially up to 65536 but needs to check the actual cap beforehand */
414411
size_t len = sizeof(routemax);
415412
if (sysctlbyname("net.fibs", &routemax, &len, NULL, 0) < 0) {
@@ -418,7 +415,6 @@ static zend_result fpm_socket_setroute_init(void) /* {{{ */
418415
}
419416

420417
return SUCCESS;
421-
#endif
422418
}
423419
/* }}} */
424420
#endif
@@ -436,8 +432,8 @@ int fpm_sockets_init_main() /* {{{ */
436432
return -1;
437433
}
438434

439-
#ifdef HAVE_SOCKETROUTE
440-
if (fpm_socket_setroute_init() == FAILURE) {
435+
#ifdef SO_SETFIB
436+
if (fpm_socket_setfib_init() == FAILURE) {
441437
return -1;
442438
}
443439
#endif

sapi/fpm/php-fpm.conf.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@
125125
; Default value: 10
126126
;systemd_interval = 10
127127

128-
; Sets the routing table for the sockets created within FPM
129-
; - FreeBSD from 0 up to 65536
130-
;socket.route = -1
131-
132128
;;;;;;;;;;;;;;;;;;;;
133129
; Pool Definitions ;
134130
;;;;;;;;;;;;;;;;;;;;

0 commit comments

Comments
 (0)