Project

General

Profile

Actions

Bug #459

closed

PF_RING 5.3.1 SVN changes to pfring_open()

Added by Chris Wakelin almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

pfring.h in SVN (PF_RING 5.3.1) now has:

  /* ********************************* */

  #define PF_RING_REENTRANT        1 << 1
  #define PF_RING_LONG_HEADER     1 << 2
  #define PF_RING_PROMISC          1 << 3

  /* ********************************* */

  pfring* pfring_open(char *device_name, u_int32_t caplen, u_int32_t flags);

whereas in PF_RING 5.3.0:-

  pfring* pfring_open(char *device_name, u_int8_t promisc, 
                      u_int32_t caplen, u_int8_t reentrant);

The change was in r5426:

r5246 | deri | 2012-03-19 22:12:21 +0000 (Mon, 19 Mar 2012) | 2 lines

Updated pfring_open* interface prototypes

Suggested fix:

--- src/source-pfring.c 2012-04-12 14:03:48.000000000 +0100
+++ src/source-pfring.c.hacked 2012-04-23 17:30:13.000000000 +0100
@@ -334,7 +334,8 @@
         SCReturnInt(TM_ECODE_FAILED);
     }

-    ptv->pd = pfring_open(ptv->interface, LIBPFRING_PROMISC, (uint32_t)default_packet_size, LIBPFRING_REENTRANT);
+/*    ptv->pd = pfring_open(ptv->interface, LIBPFRING_PROMISC, (uint32_t)default_packet_size, LIBPFRING_REENTRANT;*/
+    ptv->pd = pfring_open(ptv->interface, (uint32_t)default_packet_size, LIBPFRING_REENTRANT << 1 | LIBPFRING_PROMISC << 3);
     if (ptv->pd == NULL) {
         SCLogError(SC_ERR_PF_RING_OPEN,"opening %s failed: pfring_open error",
                 ptv->interface);

but this will need changes in configure to know when to implement the change.

I'm not sure what version number the PF_RING developers will use for the release (in the next week or so) but currently it's 5.3.1. However it does include quite a few big changes (mostly to DNA and using a new libzero library). There are probably other things we could take advantage of ...

Actions #1

Updated by Chris Wakelin almost 12 years ago

PF_RING 5.4.0 has now been released. I got segfaults with the above patch (though I thought I had it working with an earlier SVN version).

Looking through the code, it seems there were two problems:

1) The new flag PF_RING_LONG_HEADER needs to be set, at least if we have checksum validation enabled, otherwise extended_hdr isn't available.
perhaps we can make it dependent on whether checksum validation is enabled (having it disabled is supposed to give a small performance boost), but for safety I amended the patch to:-

--- source-pfring.c.orig       2012-04-12 14:03:48.000000000 +0100
+++ source-pfring.c     2012-05-14 22:56:08.570226137 +0100
@@ -104,6 +104,7 @@
 #define LIBPFRING_PROMISC     1
 #define LIBPFRING_REENTRANT   0
 #define LIBPFRING_WAIT_FOR_INCOMING 1
+#define LIBPFRING_LONG_HEADER 1

 /**
  * \brief Structure to hold thread specific variables.
@@ -334,7 +335,8 @@
         SCReturnInt(TM_ECODE_FAILED);
     }

-    ptv->pd = pfring_open(ptv->interface, LIBPFRING_PROMISC, (uint32_t)default_packet_size, LIBPFRING_REENTRANT);
+    /* ptv->pd = pfring_open(ptv->interface, LIBPFRING_PROMISC, (uint32_t)default_packet_size, LIBPFRING_REENTRANT); */
+    ptv->pd = pfring_open(ptv->interface, (uint32_t)default_packet_size, LIBPFRING_REENTRANT << 1 | LIBPFRING_LONG_HEADER << 2 | LIBPFRING_PROMISC << 3);
     if (ptv->pd == NULL) {
         SCLogError(SC_ERR_PF_RING_OPEN,"opening %s failed: pfring_open error",
                 ptv->interface);

2) configure uses the wrong prototype for pfring_open() in its test for whether pfring_recv is expecting uchar, which means it wrongly decides no.

Actions #2

Updated by Victor Julien almost 12 years ago

  • Assignee set to Eric Leblond
  • Priority changed from Normal to High
  • Target version set to 1.3beta2
  • Estimated time set to 5.00 h
Actions #3

Updated by Victor Julien almost 12 years ago

  • Status changed from New to Closed

Fix pushed to the git master, thanks!

Actions

Also available in: Atom PDF