Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfring v0.6: implements ips mode #1291

Closed
wants to merge 5 commits into from
Closed

Conversation

glongo
Copy link
Contributor

@glongo glongo commented Jan 9, 2015

This PR permits to use suricata and PF_RING in ips mode,
it addresses comments in the previous PR.

Last PR: #1288

Giuseppe Longo added 5 commits January 9, 2015 08:54
This patch adds new variables to pfring configuration:

  copy-mode
  copy-iface
  flush-packet

If copy-mode is set to ips, the packet with action DROP
are not copied to the destination interface.

If copy-mode is set to tap, all packets are copied to the
destination interface.

If flush-packet is set to no, you will decrease your CPU usage but
at the cost of sending packets in trains and thus at larger latency.
This patch adds a peering of pfring interfaces.
This is make using the PfringPeer structure,
like AF_PACKET.
This patch send the packets to the peered interface.
It also test if the packet action is drop
If HAVE_RWLOCK is not defined, in pfring library
pthread_rw_lock_t is defined as the following:

This causes some warnings:

threads.c: In function ‘ThreadMacrosTest03RWLocks’:
threads.c:92:5: warning: passing argument 1 of ‘pthread_rwlock_trywrlock’ from incompatible pointer type [enabled by default]
     r |= (SCRWLockTryWRLock(&rwl_write) == EBUSY)? 0 : 1;
     ^
In file included from threads.h:93:0,
                 from suricata-common.h:316,
                 from threads.c:27:
/usr/include/pthread.h:927:12: note: expected ‘union pthread_rwlock_t *’ but argument is of type ‘union pthread_mutex_t *’
 extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
            ^
threads.c: In function ‘ThreadMacrosTest04RWLocks’:
threads.c:108:5: warning: passing argument 1 of ‘pthread_rwlock_trywrlock’ from incompatible pointer type [enabled by default]
     r |= (SCRWLockTryWRLock(&rwl_read) == EBUSY)? 0 : 1;
     ^
In file included from threads.h:93:0,
                 from suricata-common.h:316,
                 from threads.c:27:
/usr/include/pthread.h:927:12: note: expected ‘union pthread_rwlock_t *’ but argument is of type ‘union pthread_mutex_t *’
 extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
            ^
threads.c: In function ‘ThreadMacrosTest05RWLocks’:
threads.c:124:5: warning: passing argument 1 of ‘pthread_rwlock_tryrdlock’ from incompatible pointer type [enabled by default]
     r |= (SCRWLockTryRDLock(&rwl_read) == EBUSY)? 0 : 1;
     ^
In file included from threads.h:93:0,
                 from suricata-common.h:316,
                 from threads.c:27:
/usr/include/pthread.h:912:12: note: expected ‘union pthread_rwlock_t *’ but argument is of type ‘union pthread_mutex_t *’
 extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
            ^

This patch fixes temporarily this issue
@gozzy
Copy link
Contributor

gozzy commented Jan 12, 2015

A small question: should LRO/GRO be turned off? For instance, AF_PACKET can't handle offloading - transfer size exceeds 65k and an error occurs.

@glongo
Copy link
Contributor Author

glongo commented Jan 12, 2015

@gozzy it's better to turn off LRO/GRO.
Btw could be a good idea to print a warning message, as for AF_PACKET.

@inliniac
Copy link
Contributor

It seems that it is critical to load the pf_ring module with:
modprobe pf_ring enable_tx_capture=0

Without that traffic didn't forward for me.

@inliniac
Copy link
Contributor

Regarding that last comment, can that be checked at Suricata startup?

@inliniac
Copy link
Contributor

In my testing I haven't been able to get this to work at any reasonable speed. Also latency was huge.

@inliniac inliniac closed this Jan 30, 2015
@glongo glongo deleted the dev-pf_ring-v0.6 branch February 28, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants