Linux-audit Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Architecture of auditd
@ 2013-12-25 10:48 Aaron Lewis
  2013-12-26 17:14 ` William Roberts
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lewis @ 2013-12-25 10:48 UTC (permalink / raw)
  To: linux-audit@redhat.com

Hi I wrote a very simple program to retrieve netlink sockets (audit messages),

But it stuck at recvfrom, am I missing something?

#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <sys/socket.h>
#include <linux/netlink.h>

#define ERR_QUIT(a) do { perror(a); exit (1); } while (0);

#ifndef PF_NETLINK
# define PF_NETLINK 16
#endif

char message [10000];

int main (int argc , char **argv)
{
    int fd, len;
    struct sockaddr_nl nladdr;
    socklen_t nladdrlen = sizeof(nladdr);

    fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
    if (fd < 0)
        ERR_QUIT("socket");

    len = recvfrom(fd, &message, sizeof(message), 0, (struct
sockaddr*)&nladdr, &nladdrlen);
    if (len < 0)
        ERR_QUIT("recvfrom");

    printf ("Received %d bytes\n", len);

    return 0;
}


-- 
Best Regards,
Aaron Lewis - PGP: 0xDFE6C29E ( http://keyserver.veridis.com )
Finger Print: 9482 448F C7C3 896C 1DFE 7DD3 2492 A7D0 DFE6 C29E

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-02 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25 10:48 Architecture of auditd Aaron Lewis
2013-12-26 17:14 ` William Roberts
2014-01-02 14:40   ` Steve Grubb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox