summaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
authorShawn Landden <shawnlandden@gmail.com>2013-07-08 18:28:14 +0000
committerLennart Poettering <lennart@poettering.net>2013-07-11 03:09:18 +0200
commitf7db7a691c3f532cf60886312459f2baea755283 (patch)
tree242efce2ac1d95b02892e7146bd632cfdb4d2e13 /src/core/socket.c
parent4c5420a0c1429de866c4dfbe2f973cfa241bdbe4 (diff)
basic SO_REUSEPORT support
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index 2def0c9ead..cf88bae9da 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -536,6 +536,11 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
"%sMessageQueueMessageSize: %li\n",
prefix, s->mq_msgsize);
+ if (s->reuseport)
+ fprintf(f,
+ "%sReusePort: %s\n",
+ prefix, yes_no(s->reuseport));
+
if (s->smack)
fprintf(f,
"%sSmackLabel: %s\n",
@@ -792,6 +797,12 @@ static void socket_apply_socket_options(Socket *s, int fd) {
if (setsockopt(fd, SOL_TCP, TCP_CONGESTION, s->tcp_congestion, strlen(s->tcp_congestion)+1) < 0)
log_warning_unit(UNIT(s)->id, "TCP_CONGESTION failed: %m");
+ if (s->reuseport) {
+ int b = s->reuseport;
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &b, sizeof(b)))
+ log_warning_unit(UNIT(s)->id, "SO_REUSEPORT failed: %m");
+ }
+
#ifdef HAVE_SMACK
if (s->smack_ip_in)
if (fsetxattr(fd, "security.SMACK64IPIN", s->smack_ip_in, strlen(s->smack_ip_in), 0) < 0)