mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Refactored patch (removed options, less ambiguous name)
This commit is contained in:
parent
54437c128f
commit
ba4c816b0e
6 changed files with 28 additions and 52 deletions
|
@ -5,25 +5,8 @@
|
|||
|
||||
#ifdef HAVE_PACKET_FANOUT
|
||||
#include <linux/if_packet.h>
|
||||
#ifndef PACKET_FANOUT
|
||||
#define PACKET_FANOUT 18
|
||||
#define PACKET_FANOUT_HASH 0
|
||||
#define PACKET_FANOUT_LB 1
|
||||
#define PACKET_FANOUT_CPU 2
|
||||
#define PACKET_FANOUT_FLAG_DEFRAG 0x8000
|
||||
|
||||
#ifndef PACKET_FANOUT_ROLLOVER
|
||||
#define PACKET_FANOUT_ROLLOVER 3
|
||||
#endif
|
||||
|
||||
#ifndef PACKET_FANOUT_FLAG_ROLLOVER
|
||||
#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
|
||||
#endif
|
||||
|
||||
#define PACKET_FANOUT_FLAG_NONE -1
|
||||
#endif /* PACKET_FANOUT */
|
||||
#endif /* HAVE_PACKET_FANOUT */
|
||||
|
||||
extern "C" {
|
||||
#include <pcap.h>
|
||||
}
|
||||
|
|
|
@ -161,10 +161,14 @@ void PcapSource::OpenLive()
|
|||
|
||||
#ifdef HAVE_PACKET_FANOUT
|
||||
/* Turn on cluster mode for the device. */
|
||||
if ( fanout_enable )
|
||||
if ( packet_fanout_enable )
|
||||
{
|
||||
uint32_t fanout_arg = (fanout_method << 16) | (fanout_id & 0xffff);
|
||||
if (setsockopt(props.selectable_fd, SOL_PACKET, PACKET_FANOUT, &fanout_arg, sizeof(fanout_arg)) == -1)
|
||||
uint32_t packet_fanout_arg = (PACKET_FANOUT_HASH << 16) | (packet_fanout_id & 0xffff);
|
||||
|
||||
if ( packet_fanout_flag_defrag )
|
||||
packet_fanout_arg |= (PACKET_FANOUT_FLAG_DEFRAG << 16);
|
||||
|
||||
if (setsockopt(props.selectable_fd, SOL_PACKET, PACKET_FANOUT, &packet_fanout_arg, sizeof(packet_fanout_arg)) == -1)
|
||||
{
|
||||
Error(fmt("%s: setsockopt: %s", __FUNCTION__, strerror(errno)));
|
||||
return;
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
#include "../PktSrc.h"
|
||||
|
||||
#ifdef HAVE_PACKET_FANOUT
|
||||
extern bool fanout_enable;
|
||||
extern int fanout_id;
|
||||
extern int fanout_method;
|
||||
extern int fanout_flag;
|
||||
extern bool packet_fanout_enable;
|
||||
extern int packet_fanout_id;
|
||||
extern bool packet_fanout_flag_defrag;
|
||||
#endif
|
||||
|
||||
namespace iosource {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue