Go to the documentation of this file.
31 ConfNode *if_root,
ConfNode *if_default,
const char *iface,
const char **bpf_filter)
33 if (*bpf_filter != NULL) {
34 SCLogInfo(
"BPF filter already configured");
39 if (
ConfGet(
"bpf-filter", bpf_filter) == 1) {
40 if (strlen(*bpf_filter) > 0) {
41 SCLogConfig(
"%s: using command-line provided bpf filter '%s'", iface, *bpf_filter);
45 if (strlen(*bpf_filter) > 0) {
46 SCLogConfig(
"%s: using file provided bpf filter %s", iface, *bpf_filter);
59 pcap_freecode(program);
62 int SCBPFCompile(
int snaplen_arg,
int linktype_arg,
struct bpf_program *program,
64 int optimize, uint32_t mask,
65 char *errbuf,
size_t errbuf_len)
70 p = pcap_open_dead(linktype_arg, snaplen_arg);
75 ret = pcap_compile(p, program, buf, optimize, mask);
78 snprintf(errbuf, errbuf_len,
"%s", pcap_geterr(p));
87 if (program->bf_insns == NULL) {
89 snprintf(errbuf, errbuf_len,
"Filter badly setup");
#define SCMUTEX_INITIALIZER
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
#define SCMutexUnlock(mut)
int ConfGetChildValueWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, const char **vptr)
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
void ConfSetBPFFilter(ConfNode *if_root, ConfNode *if_default, const char *iface, const char **bpf_filter)
void SCBPFFree(struct bpf_program *program)
struct SCLogConfig_ SCLogConfig
Holds the config state used by the logging api.
int SCBPFCompile(int snaplen_arg, int linktype_arg, struct bpf_program *program, const char *buf, int optimize, uint32_t mask, char *errbuf, size_t errbuf_len)