All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter.Muller@gmx.at
To: netfilter@lists.netfilter.org
Subject: ipq_read error
Date: Thu, 27 Oct 2005 12:08:51 +0200 (MEST)	[thread overview]
Message-ID: <12274.1130407731@www36.gmx.net> (raw)

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


             reply	other threads:[~2005-10-27 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-27 10:08 Peter.Muller [this message]
2005-10-27 11:58 ` ipq_read error Eric Leblond
  -- strict thread matches above, loose matches on Subject: below --
2003-11-20 14:15 ipq_read() error Sylvie Colin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12274.1130407731@www36.gmx.net \
    --to=peter.muller@gmx.at \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.