Enable Kernel BPF JIT compiler from dumpcap.
svn path=/trunk/; revision=51472
This commit is contained in:
parent
cc2a6a47a9
commit
5928ded2b4
21
dumpcap.c
21
dumpcap.c
|
@ -171,6 +171,25 @@ static void capture_loop_stop(void);
|
||||||
/** Close a pipe, or socket if \a from_socket is TRUE */
|
/** Close a pipe, or socket if \a from_socket is TRUE */
|
||||||
static void cap_pipe_close(int pipe_fd, gboolean from_socket _U_);
|
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__)
|
#if !defined (__linux__)
|
||||||
#ifndef HAVE_PCAP_BREAKLOOP
|
#ifndef HAVE_PCAP_BREAKLOOP
|
||||||
/*
|
/*
|
||||||
|
@ -4384,6 +4403,8 @@ main(int argc, char *argv[])
|
||||||
#endif /* SIGINFO */
|
#endif /* SIGINFO */
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
enable_kernel_bpf_jit_compiler();
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
/* Privilege and capability handling */
|
/* Privilege and capability handling */
|
||||||
/* Cases: */
|
/* Cases: */
|
||||||
|
|
Loading…
Reference in New Issue