summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/socket.c b/src/socket.c
index e8b2d968d6..1020c94de2 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -405,6 +405,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
"%sKeepAlive: %s\n"
"%sFreeBind: %s\n"
"%sTransparent: %s\n"
+ "%sBroadcast: %s\n"
"%sTCPCongestion: %s\n",
prefix, socket_state_to_string(s->state),
prefix, socket_address_bind_ipv6_only_to_string(s->bind_ipv6_only),
@@ -414,6 +415,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
prefix, yes_no(s->keep_alive),
prefix, yes_no(s->free_bind),
prefix, yes_no(s->transparent),
+ prefix, yes_no(s->broadcast),
prefix, strna(s->tcp_congestion));
if (s->control_pid > 0)
@@ -649,6 +651,12 @@ static void socket_apply_socket_options(Socket *s, int fd) {
log_warning("SO_KEEPALIVE failed: %m");
}
+ if (s->broadcast) {
+ int one = 1;
+ if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one)) < 0)
+ log_warning("SO_BROADCAST failed: %m");
+ }
+
if (s->priority >= 0)
if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &s->priority, sizeof(s->priority)) < 0)
log_warning("SO_PRIORITY failed: %m");