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
Conversation
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
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. |
@gozzy it's better to turn off LRO/GRO. |
It seems that it is critical to load the pf_ring module with: Without that traffic didn't forward for me. |
Regarding that last comment, can that be checked at Suricata startup? |
In my testing I haven't been able to get this to work at any reasonable speed. Also latency was huge. |
This PR permits to use suricata and PF_RING in ips mode,
it addresses comments in the previous PR.
Last PR: #1288