ipq_read error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

I'm using libipq's ipq_read function in a program to read packets that were
queued to userspace by a kernel module.

When I run the program as root everything is fine. ipq_read gets all the
queued messages. If the program is run with user privileges ipq_read fails.
ipq_get_msgerr(buf) returns 1 and ipq_errstr returns "Unknown error".

In the program I do the following:

[left out]

int status;
unsigned char buf[2048];
struct ipq_handle *h;
h = ipq_create_handle(0, PF_INET);
if (!h)
    die(h);

status = ipq_set_mode(h, IPQ_COPY_PACKET, BUFSIZE);
if (status < 0)
    die(h);

status = ipq_read(h, buf, BUFSIZE, 0);
printf("Received packet!\n");
if (status < 0)
    die(h);
printf("Alive!\n");
switch (ipq_message_type(buf)) {
    case NLMSG_ERROR:
        fprintf(stderr, "Received error message %d\n",
            ipq_get_msgerr(buf));
        break;

[left out]

Does ipq_read really needs root privileges or are there other solutions? Any
help on this is appreciated.

Cheers
Peter




-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux