0
votes

I'm trying to set up an nfq listener based on This bit of code:

main (int argc, char **argv)
{
  struct nfq_handle *h;
  struct nfq_q_handle *qh;
  struct nfnl_handle *nh;
  int fd;
  int rv;
  char buf[4096] __attribute__ ((aligned));

  printf ("opening library handle\n");
  h = nfq_open ();
  if (!h)
  {
      fprintf (stderr, "error during nfq_open()\n");
      exit (1);
  }
  ...

I have the following iptables rule set: NFQUEUE udp -- 0.0.0.0/0 192.168.50.0/24 udp dpt:10000 NFQUEUE num 5061

But running the program always gives: Error during nfq_open()

Is there something incorrect with my IPtables rule? I used the following command:

/sbin/iptables -A FORWARD --protocol udp --dport 10000 -j NFQUEUE --queue-num 5061 -d 192.168.50.0/24

Thanks.

2

2 Answers

0
votes

Please add "-t" switch with the table name "nat|filter|mangle" in which you want to add rule.

0
votes

This won't be an issue with the iptables command at all. I would guess that you are not running the program as root, which is required to use NFQUEUE.