|
|
7dd887 |
From 9dcfa5bda8c03d0acecd87953ebfc78372bb9755 Mon Sep 17 00:00:00 2001
|
|
|
7dd887 |
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
|
|
|
7dd887 |
Date: Tue, 28 Jun 2016 13:02:45 +0200
|
|
|
7dd887 |
Subject: [PATCH 07/17] socket.7: document SO_REUSEPORT option
|
|
|
7dd887 |
|
|
|
7dd887 |
---
|
|
|
7dd887 |
man-pages/man7/socket.7 | 33 +++++++++++++++++++++++++++++++++
|
|
|
7dd887 |
1 file changed, 33 insertions(+)
|
|
|
7dd887 |
|
|
|
7dd887 |
diff --git a/man-pages/man7/socket.7 b/man-pages/man7/socket.7
|
|
|
7dd887 |
index 17bd0c3..94c98b6 100644
|
|
|
7dd887 |
--- a/man-pages/man7/socket.7
|
|
|
7dd887 |
+++ b/man-pages/man7/socket.7
|
|
|
7dd887 |
@@ -649,6 +649,39 @@ with a specific port then it is not possible
|
|
|
7dd887 |
to bind to this port for any local address.
|
|
|
7dd887 |
Argument is an integer boolean flag.
|
|
|
7dd887 |
.TP
|
|
|
7dd887 |
+.BR SO_REUSEPORT
|
|
|
7dd887 |
+Permits multiple
|
|
|
7dd887 |
+.B AF_INET
|
|
|
7dd887 |
+or
|
|
|
7dd887 |
+.B AF_INET6
|
|
|
7dd887 |
+sockets to be bound to an identical socket address.
|
|
|
7dd887 |
+This option must be set on each socket (including the first socket)
|
|
|
7dd887 |
+prior to calling
|
|
|
7dd887 |
+.BR bind (2)
|
|
|
7dd887 |
+on the socket.
|
|
|
7dd887 |
+To prevent port hijacking,
|
|
|
7dd887 |
+all of the processes binding to the same address must have the same
|
|
|
7dd887 |
+effective UID.
|
|
|
7dd887 |
+This option can be employed with both TCP and UDP sockets.
|
|
|
7dd887 |
+
|
|
|
7dd887 |
+For TCP sockets, this option allows
|
|
|
7dd887 |
+.BR accept (2)
|
|
|
7dd887 |
+load distribution in a multi-threaded server to be improved by
|
|
|
7dd887 |
+using a distinct listener socket for each thread.
|
|
|
7dd887 |
+This provides improved load distribution as compared
|
|
|
7dd887 |
+to traditional techniques such using a single
|
|
|
7dd887 |
+.BR accept (2)ing
|
|
|
7dd887 |
+thread that distributes connections,
|
|
|
7dd887 |
+or having multiple threads that compete to
|
|
|
7dd887 |
+.BR accept (2)
|
|
|
7dd887 |
+from the same socket.
|
|
|
7dd887 |
+
|
|
|
7dd887 |
+For UDP sockets,
|
|
|
7dd887 |
+the use of this option can provide better distribution
|
|
|
7dd887 |
+of incoming datagrams to multiple processes (or threads) as compared
|
|
|
7dd887 |
+to the traditional technique of having multiple processes
|
|
|
7dd887 |
+compete to receive datagrams on the same socket.
|
|
|
7dd887 |
+.TP
|
|
|
7dd887 |
.B SO_SNDBUF
|
|
|
7dd887 |
Sets or gets the maximum socket send buffer in bytes.
|
|
|
7dd887 |
The kernel doubles this value (to allow space for bookkeeping overhead)
|
|
|
7dd887 |
--
|
|
|
7dd887 |
2.7.4
|
|
|
7dd887 |
|