]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
socket: downgrade log warnings about inability to set socket buffer sizes
authorLennart Poettering <lennart@poettering.net>
Fri, 11 Sep 2020 17:58:54 +0000 (19:58 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 12 Sep 2020 06:14:54 +0000 (08:14 +0200)
In containers we might lack the privs to up the socket buffers. Let's
not complain so loudly about that. Let's hence downgrade this to debug
logging if it's a permission problem.

(This wasn't an issue before b92f350789e33942be0cf85af22a580c1fd483d6
because back then the failures wouldn't be detected at all.)

src/core/socket.c

index 04177ea7a51404437f15d8a267d5c953f12a77b3..02841f0e2469e084f6c9fb0b41dde11b7b03a490 100644 (file)
@@ -1061,13 +1061,15 @@ static void socket_apply_socket_options(Socket *s, SocketPort *p, int fd) {
         if (s->receive_buffer > 0) {
                 r = fd_set_rcvbuf(fd, s->receive_buffer, false);
                 if (r < 0)
-                        log_unit_warning_errno(UNIT(s), r, "SO_RCVBUF/SO_RCVBUFFORCE failed: %m");
+                        log_unit_full_errno(UNIT(s), ERRNO_IS_PRIVILEGE(r) ? LOG_DEBUG : LOG_WARNING, r,
+                                            "SO_RCVBUF/SO_RCVBUFFORCE failed: %m");
         }
 
         if (s->send_buffer > 0) {
                 r = fd_set_sndbuf(fd, s->send_buffer, false);
                 if (r < 0)
-                        log_unit_warning_errno(UNIT(s), r, "SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
+                        log_unit_full_errno(UNIT(s), ERRNO_IS_PRIVILEGE(r) ? LOG_DEBUG : LOG_WARNING, r,
+                                            "SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
         }
 
         if (s->mark >= 0) {