Enable Kernel BPF JIT compiler from dumpcap.

svn path=/trunk/; revision=51472
This commit is contained in:
Anders Broman 2013-08-22 17:20:09 +00:00
parent cc2a6a47a9
commit 5928ded2b4
1 changed files with 21 additions and 0 deletions

View File

@ -171,6 +171,25 @@ static void capture_loop_stop(void);
/** Close a pipe, or socket if \a from_socket is TRUE */
static void cap_pipe_close(int pipe_fd, gboolean from_socket _U_);
/* Enable kernel BPF jit compiler if available */
int enable_kernel_bpf_jit_compiler(void)
{
int fd;
ssize_t ret;
const char *file = "/proc/sys/net/core/bpf_jit_enable";
fd = open(file, O_WRONLY);
if (fd < 0)
return -1;
ret = write(fd, "1", (unsigned int)strlen("1"));
close(fd);
return ret;
}
#if !defined (__linux__)
#ifndef HAVE_PCAP_BREAKLOOP
/*
@ -4384,6 +4403,8 @@ main(int argc, char *argv[])
#endif /* SIGINFO */
#endif /* _WIN32 */
enable_kernel_bpf_jit_compiler();
/* ----------------------------------------------------------------- */
/* Privilege and capability handling */
/* Cases: */