Skip to content

Commit abea35d

Browse files
committed
prevent netlink congestion
1 parent 3bfa048 commit abea35d

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/auditd.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include <sys/time.h>
3535
#include <sys/stat.h>
3636
#include <sys/wait.h>
37+
#include <sys/socket.h>
38+
#include <linux/netlink.h>
3739
#include <fcntl.h>
3840
#include <pthread.h>
3941
#include <sys/utsname.h>
@@ -714,7 +716,7 @@ int main(int argc, char *argv[])
714716
struct sigaction sa;
715717
sigset_t sigchld_mask;
716718
struct rlimit limit;
717-
int i, c, rc;
719+
int i, c, rc, one = 1;
718720
static const struct option opts[] = {
719721
{"foreground", no_argument, NULL, 'f'},
720722
{"allow_links", no_argument, NULL, 'l'},
@@ -877,6 +879,17 @@ int main(int argc, char *argv[])
877879
free_config(&config);
878880
return 1;
879881
}
882+
// Prevent netlink congestion issues
883+
if (setsockopt(fd, SOL_NETLINK, NETLINK_NO_ENOBUFS,
884+
&one, sizeof(one)) < 0) {
885+
audit_msg(LOG_ERR,
886+
"Cannot set netlink no enobufs option (%s)",
887+
strerror(errno));
888+
audit_close(fd);
889+
tell_parent(FAILURE);
890+
free_config(&config);
891+
return 1;
892+
}
880893

881894
if (make_audit_run_dir() < 0) {
882895
tell_parent(FAILURE);

0 commit comments

Comments
 (0)