[systemd-commits] 2 commits - man/systemd.socket.xml src/dbus-socket.c src/load-fragment.c src/socket.c src/socket.h src/util.c TODO

Lennart Poettering lennart at kemper.freedesktop.org
Thu May 19 09:10:41 PDT 2011


 TODO                   |    2 ++
 man/systemd.socket.xml |   10 ++++++++++
 src/dbus-socket.c      |    2 ++
 src/load-fragment.c    |    1 +
 src/socket.c           |    8 ++++++++
 src/socket.h           |    1 +
 src/util.c             |    2 +-
 7 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 74bc3bdc2096e6710c13052fa848649c9ed1dfa5
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu May 19 18:10:34 2011 +0200

    util: use open_terminal() in chvt() too

diff --git a/src/util.c b/src/util.c
index 14aa1f9..021be62 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2141,7 +2141,7 @@ bool fstype_is_network(const char *fstype) {
 int chvt(int vt) {
         int fd, r = 0;
 
-        if ((fd = open("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0)
+        if ((fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0)
                 return -errno;
 
         if (vt < 0) {

commit ec6370a22dbb96f855011e75f08e88df9e45504d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu May 19 18:10:19 2011 +0200

    socket: expose SO_BROADCAST

diff --git a/TODO b/TODO
index 389e5e9..80e8397 100644
--- a/TODO
+++ b/TODO
@@ -19,6 +19,8 @@ F15 External:
 
 Features:
 
+* drop -lrt req for sd-daemon.[ch]
+
 * Make it possible to set the keymap independently from the font on
   the kernel cmdline. Right now setting one resets also the other.
 
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 5350266..6d81f91 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -515,6 +515,16 @@
                         </varlistentry>
 
                         <varlistentry>
+                                <term><varname>Broadcast=</varname></term>
+                                <listitem><para>Takes a boolean
+                                value. This controls the SO_BROADCAST
+                                option, which allows boradcast
+                                datagrams to be sent from this
+                                socket. Defaults to
+                                <option>false</option>.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
                                 <term><varname>TCPCongestion=</varname></term>
                                 <listitem><para>Takes a string
                                 value. Controls the TCP congestion
diff --git a/src/dbus-socket.c b/src/dbus-socket.c
index f6edc80..b81569d 100644
--- a/src/dbus-socket.c
+++ b/src/dbus-socket.c
@@ -50,6 +50,7 @@
         "  <property name=\"PipeSize\" type=\"t\" access=\"read\"/>\n"  \
         "  <property name=\"FreeBind\" type=\"b\" access=\"read\"/>\n"  \
         "  <property name=\"Transparent\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"Broadcast\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"Mark\" type=\"i\" access=\"read\"/>\n"      \
         "  <property name=\"MaxConnections\" type=\"u\" access=\"read\"/>\n" \
         "  <property name=\"NAccepted\" type=\"u\" access=\"read\"/>\n" \
@@ -109,6 +110,7 @@ DBusHandlerResult bus_socket_message_handler(Unit *u, DBusConnection *c, DBusMes
                 { "org.freedesktop.systemd1.Socket", "PipeSize",       bus_property_append_size,         "t", &u->socket.pipe_size       },
                 { "org.freedesktop.systemd1.Socket", "FreeBind",       bus_property_append_bool,         "b", &u->socket.free_bind       },
                 { "org.freedesktop.systemd1.Socket", "Transparent",    bus_property_append_bool,         "b", &u->socket.transparent     },
+                { "org.freedesktop.systemd1.Socket", "Broadcast",      bus_property_append_bool,         "b", &u->socket.broadcast       },
                 { "org.freedesktop.systemd1.Socket", "Mark",           bus_property_append_int,          "i", &u->socket.mark            },
                 { "org.freedesktop.systemd1.Socket", "MaxConnections", bus_property_append_unsigned,     "u", &u->socket.max_connections },
                 { "org.freedesktop.systemd1.Socket", "NConnections",   bus_property_append_unsigned,     "u", &u->socket.n_connections   },
diff --git a/src/load-fragment.c b/src/load-fragment.c
index dbb0762..56eaed9 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -1996,6 +1996,7 @@ static int load_from_path(Unit *u, const char *path) {
                 { "PipeSize",               config_parse_size,            0, &u->socket.pipe_size,                            "Socket"  },
                 { "FreeBind",               config_parse_bool,            0, &u->socket.free_bind,                            "Socket"  },
                 { "Transparent",            config_parse_bool,            0, &u->socket.transparent,                          "Socket"  },
+                { "Broadcast",              config_parse_bool,            0, &u->socket.broadcast,                            "Socket"  },
                 { "TCPCongestion",          config_parse_string,          0, &u->socket.tcp_congestion,                       "Socket"  },
                 { "MessageQueueMaxMessages", config_parse_long,           0, &u->socket.mq_maxmsg,                            "Socket"  },
                 { "MessageQueueMessageSize", config_parse_long,           0, &u->socket.mq_msgsize,                           "Socket"  },
diff --git a/src/socket.c b/src/socket.c
index e8b2d96..1020c94 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");
diff --git a/src/socket.h b/src/socket.h
index 92f11d7..fd13ac4 100644
--- a/src/socket.h
+++ b/src/socket.h
@@ -117,6 +117,7 @@ struct Socket {
         bool keep_alive;
         bool free_bind;
         bool transparent;
+        bool broadcast;
         int priority;
         int mark;
         size_t receive_buffer;



More information about the systemd-commits mailing list