chiark / gitweb /
loopback-setup: correctly set flags and scope for ipv6 address
[elogind.git] / src / libsystemd-bus / bus-socket.c
index 69f78c9a58f599e9aa55173a435b56363efb4be0..a7eaf5099d64089018753c5d77ef73b86ad06782 100644 (file)
@@ -38,6 +38,8 @@
 #include "bus-internal.h"
 #include "bus-message.h"
 
+#define SNDBUF_SIZE (8*1024*1024)
+
 static void iovec_advance(struct iovec iov[], unsigned *idx, size_t size) {
 
         while (size > 0) {
@@ -614,15 +616,19 @@ int bus_socket_setup(sd_bus *b) {
         enable = !b->bus_client && (b->attach_flags & KDBUS_ATTACH_SECLABEL);
         setsockopt(b->input_fd, SOL_SOCKET, SO_PASSSEC, &enable, sizeof(enable));
 
-        /* Increase the buffers to a MB */
-        fd_inc_rcvbuf(b->input_fd, 1024*1024);
-        fd_inc_sndbuf(b->output_fd, 1024*1024);
+        /* Increase the buffers to 8 MB */
+        fd_inc_rcvbuf(b->input_fd, SNDBUF_SIZE);
+        fd_inc_sndbuf(b->output_fd, SNDBUF_SIZE);
 
         /* Get the peer for socketpair() sockets */
         l = sizeof(b->ucred);
         if (getsockopt(b->input_fd, SOL_SOCKET, SO_PEERCRED, &b->ucred, &l) >= 0 && l >= sizeof(b->ucred))
                 b->ucred_valid = b->ucred.pid > 0;
 
+        b->is_kernel = false;
+        b->message_version = 1;
+        b->message_endian = 0;
+
         return 0;
 }
 
@@ -765,6 +771,10 @@ int bus_socket_exec(sd_bus *b) {
         close_nointr_nofail(s[1]);
         b->output_fd = b->input_fd = s[0];
 
+        r = bus_socket_setup(b);
+        if (r < 0)
+                return r;
+
         return bus_socket_start_auth(b);
 }