summaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-07-05 13:49:16 +0000
committerIgor Sysoev <igor@sysoev.ru>2010-07-05 13:49:16 +0000
commit0bd7a7d8941087929b270f7862f1bbacc69282c1 (patch)
tree42c25fc6de1079f8b91b0cd16160b288c44d3705 /src/core
parent1a5d7553da68081ffa3e0a5b89ee844fbd8a7f14 (diff)
downloadnginx-0bd7a7d8941087929b270f7862f1bbacc69282c1.tar.gz
nginx-0bd7a7d8941087929b270f7862f1bbacc69282c1.tar.bz2
listen setfib=X
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_connection.c36
-rw-r--r--src/core/ngx_connection.h3
2 files changed, 39 insertions, 0 deletions
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 4a90b6120..c495edd52 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -74,6 +74,10 @@ ngx_create_listening(ngx_conf_t *cf, void *sockaddr, socklen_t socklen)
ls->rcvbuf = -1;
ls->sndbuf = -1;
+#if (NGX_HAVE_SETFIB)
+ ls->setfib = -1;
+#endif
+
return ls;
}
@@ -179,6 +183,25 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
ls[i].sndbuf = -1;
}
+#if 0
+ /* SO_SETFIB is currently a set only option */
+
+#if (NGX_HAVE_SETFIB)
+
+ if (getsockopt(ls[i].setfib, SOL_SOCKET, SO_SETFIB,
+ (void *) &ls[i].setfib, &olen)
+ == -1)
+ {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
+ "getsockopt(SO_SETFIB) %V failed, ignored",
+ &ls[i].addr_text);
+
+ ls[i].setfib = -1;
+ }
+
+#endif
+#endif
+
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
ngx_memzero(&af, sizeof(struct accept_filter_arg));
@@ -473,6 +496,19 @@ ngx_configure_listening_sockets(ngx_cycle_t *cycle)
}
}
+#if (NGX_HAVE_SETFIB)
+ if (ls[i].setfib != -1) {
+ if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SETFIB,
+ (const void *) &ls[i].setfib, sizeof(int))
+ == -1)
+ {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
+ "setsockopt(SO_SETFIB, %d) %V failed, ignored",
+ ls[i].setfib, &ls[i].addr_text);
+ }
+ }
+#endif
+
#if 0
if (1) {
int tcp_nodelay = 1;
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index 1810daca0..3837fd255 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -69,6 +69,9 @@ struct ngx_listening_s {
char *accept_filter;
#endif
#endif
+#if (NGX_HAVE_SETFIB)
+ int setfib;
+#endif
};