Skip to content

Commit fecdee0

Browse files
committed
socket: downgrade not-supported logging for SO_PASSSEC
Kernel 6.16 started returning EOPNOTSUPP when a required kconfig is disabled. Downgrade to debug level in that case. Fixes systemd/systemd#37783 (cherry picked from commit bb887cf) (cherry picked from commit 42cc4991976821d33b094a4d3787cd6b80a8fbdb) (cherry picked from commit 1613414ac0a5a370e8754943c273f49ba37edaf3) (cherry picked from commit b97861d) (cherry picked from commit 17cccd3)
1 parent d4440e9 commit fecdee0

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/core/socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ static void socket_apply_socket_options(Socket *s, SocketPort *p, int fd) {
10291029
if (s->pass_sec) {
10301030
r = setsockopt_int(fd, SOL_SOCKET, SO_PASSSEC, true);
10311031
if (r < 0)
1032-
log_unit_warning_errno(UNIT(s), r, "SO_PASSSEC failed: %m");
1032+
log_unit_full_errno(UNIT(s), ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING, r, "SO_PASSSEC failed: %m");
10331033
}
10341034

10351035
if (s->pass_pktinfo) {

src/journal/journald-native.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <unistd.h>
88

99
#include "alloc-util.h"
10+
#include "errno-util.h"
1011
#include "fd-util.h"
1112
#include "fs-util.h"
1213
#include "io-util.h"
@@ -509,7 +510,7 @@ int server_open_native_socket(Server *s, const char *native_socket) {
509510
if (mac_selinux_use()) {
510511
r = setsockopt_int(s->native_fd, SOL_SOCKET, SO_PASSSEC, true);
511512
if (r < 0)
512-
log_warning_errno(r, "SO_PASSSEC failed: %m");
513+
log_full_errno(ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING, r, "SO_PASSSEC failed: %m");
513514
}
514515

515516
r = setsockopt_int(s->native_fd, SOL_SOCKET, SO_TIMESTAMP, true);

src/journal/journald-syslog.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "sd-messages.h"
88

99
#include "alloc-util.h"
10+
#include "errno-util.h"
1011
#include "fd-util.h"
1112
#include "format-util.h"
1213
#include "io-util.h"
@@ -492,7 +493,7 @@ int server_open_syslog_socket(Server *s, const char *syslog_socket) {
492493
if (mac_selinux_use()) {
493494
r = setsockopt_int(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, true);
494495
if (r < 0)
495-
log_warning_errno(r, "SO_PASSSEC failed: %m");
496+
log_full_errno(ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING, r, "SO_PASSSEC failed: %m");
496497
}
497498

498499
r = setsockopt_int(s->syslog_fd, SOL_SOCKET, SO_TIMESTAMP, true);

0 commit comments

Comments
 (0)