summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fixme10
-rw-r--r--src/dbus-socket.c6
-rw-r--r--src/load-fragment.c17
-rw-r--r--src/socket-util.c8
-rw-r--r--src/socket-util.h7
-rw-r--r--src/socket.c2
-rw-r--r--src/socket.h3
7 files changed, 36 insertions, 17 deletions
diff --git a/fixme b/fixme
index b8d0fca354..08ba2dda1b 100644
--- a/fixme
+++ b/fixme
@@ -37,8 +37,6 @@
* provide sysv-like command line utilities
-* Add OnlyByDependency
-
* ability to kill services? i.e. in contrast to stopping them, go directly
into killing mode?
@@ -48,9 +46,9 @@
- nscd DONE
- dbus DONE
- rsyslog DONE
- - rpcbind (/var/run/rpcbind.sock!)
- - avahi-daemon (/var/run/avahi-daemon/socket)
- - cups
+ - rpcbind (/var/run/rpcbind.sock!) DONE
+ - cups DONE
+ - avahi-daemon (/var/run/avahi-daemon/socket) DONE
- ssh CLASSIC
- postfix, saslauthd
- apache/samba
@@ -63,7 +61,7 @@
* Figure out which signal handlers we actually have to reset in the
forked off child
-* loopback-setup is borked for ipv6
+* Add code to systemctl to wait for an operation to finish
Regularly:
diff --git a/src/dbus-socket.c b/src/dbus-socket.c
index 2a2349c00d..cb244a9003 100644
--- a/src/dbus-socket.c
+++ b/src/dbus-socket.c
@@ -19,6 +19,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <errno.h>
+
#include "dbus-unit.h"
#include "dbus-socket.h"
#include "dbus-execute.h"
@@ -43,10 +45,12 @@ static const char introspection[] =
BUS_INTROSPECTABLE_INTERFACE
"</node>";
+static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_socket_append_bind_ipv6_only, socket_address_bind_ipv6_only, SocketAddressBindIPv6Only);
+
DBusHandlerResult bus_socket_message_handler(Unit *u, DBusMessage *message) {
const BusProperty properties[] = {
BUS_UNIT_PROPERTIES,
- { "org.freedesktop.systemd1.Socket", "BindIPv6Only", bus_property_append_bool, "b", &u->socket.bind_ipv6_only },
+ { "org.freedesktop.systemd1.Socket", "BindIPv6Only", bus_socket_append_bind_ipv6_only, "s", &u->socket.bind_ipv6_only },
{ "org.freedesktop.systemd1.Socket", "Backlog", bus_property_append_unsigned, "u", &u->socket.backlog },
{ "org.freedesktop.systemd1.Socket", "TimeoutUSec", bus_property_append_usec, "t", &u->socket.timeout_usec },
/* ExecCommand */
diff --git a/src/load-fragment.c b/src/load-fragment.c
index 5e0637de65..3ebea4316f 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -252,8 +252,8 @@ static int config_parse_socket_bind(
void *data,
void *userdata) {
- int r;
Socket *s;
+ SocketAddressBindIPv6Only b;
assert(filename);
assert(lvalue);
@@ -262,12 +262,17 @@ static int config_parse_socket_bind(
s = (Socket*) data;
- if ((r = parse_boolean(rvalue)) < 0) {
- log_error("[%s:%u] Failed to parse bind IPv6 only value: %s", filename, line, rvalue);
- return r;
- }
+ if ((b = socket_address_bind_ipv6_only_from_string(rvalue)) < 0) {
+ int r;
- s->bind_ipv6_only = r ? SOCKET_ADDRESS_IPV6_ONLY : SOCKET_ADDRESS_BOTH;
+ if ((r = parse_boolean(rvalue)) < 0) {
+ log_error("[%s:%u] Failed to parse bind IPv6 only value: %s", filename, line, rvalue);
+ return -EBADMSG;
+ }
+
+ s->bind_ipv6_only = r ? SOCKET_ADDRESS_IPV6_ONLY : SOCKET_ADDRESS_BOTH;
+ } else
+ s->bind_ipv6_only = b;
return 0;
}
diff --git a/src/socket-util.c b/src/socket-util.c
index 32f6bcb941..0c9fc9f999 100644
--- a/src/socket-util.c
+++ b/src/socket-util.c
@@ -466,3 +466,11 @@ bool socket_address_needs_mount(const SocketAddress *a, const char *prefix) {
return path_startswith(a->sockaddr.un.sun_path, prefix);
}
+
+static const char* const socket_address_bind_ipv6_only_table[_SOCKET_ADDRESS_BIND_IPV6_ONLY_MAX] = {
+ [SOCKET_ADDRESS_DEFAULT] = "default",
+ [SOCKET_ADDRESS_BOTH] = "both",
+ [SOCKET_ADDRESS_IPV6_ONLY] = "ipv6-only"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(socket_address_bind_ipv6_only, SocketAddressBindIPv6Only);
diff --git a/src/socket-util.h b/src/socket-util.h
index 14192167aa..993972c458 100644
--- a/src/socket-util.h
+++ b/src/socket-util.h
@@ -50,7 +50,9 @@ typedef struct SocketAddress {
typedef enum SocketAddressBindIPv6Only {
SOCKET_ADDRESS_DEFAULT,
SOCKET_ADDRESS_BOTH,
- SOCKET_ADDRESS_IPV6_ONLY
+ SOCKET_ADDRESS_IPV6_ONLY,
+ _SOCKET_ADDRESS_BIND_IPV6_ONLY_MAX,
+ _SOCKET_ADDRESS_BIND_IPV6_ONLY_INVALID = -1
} SocketAddressBindIPv6Only;
#define socket_address_family(a) ((a)->sockaddr.sa.sa_family)
@@ -76,4 +78,7 @@ bool socket_address_equal(const SocketAddress *a, const SocketAddress *b);
bool socket_address_needs_mount(const SocketAddress *a, const char *prefix);
+const char* socket_address_bind_ipv6_only_to_string(SocketAddressBindIPv6Only b);
+SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *s);
+
#endif
diff --git a/src/socket.c b/src/socket.c
index f9da353c12..4647d3174e 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -290,7 +290,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
"%sSocketMode: %04o\n"
"%sDirectoryMode: %04o\n",
prefix, socket_state_to_string(s->state),
- prefix, yes_no(s->bind_ipv6_only),
+ prefix, socket_address_bind_ipv6_only_to_string(s->bind_ipv6_only),
prefix, s->backlog,
prefix, kill_mode_to_string(s->kill_mode),
prefix, s->socket_mode,
diff --git a/src/socket.h b/src/socket.h
index 43d28d7e04..5aa5f2783c 100644
--- a/src/socket.h
+++ b/src/socket.h
@@ -70,7 +70,6 @@ struct SocketPort {
SocketAddress address;
char *path;
-
Watch fd_watch;
LIST_FIELDS(SocketPort, port);
@@ -82,7 +81,7 @@ struct Socket {
LIST_HEAD(SocketPort, ports);
/* Only for INET6 sockets: issue IPV6_V6ONLY sockopt */
- bool bind_ipv6_only;
+ SocketAddressBindIPv6Only bind_ipv6_only;
unsigned backlog;
usec_t timeout_usec;