Permalink
Browse files

ubuntu kernel fix

  • Loading branch information...
cardigliano committed Jul 6, 2016
1 parent adcf923 commit 0e4738d563cbb39e1ce88c116278a390ccc6d0a7
Showing with 26 additions and 2 deletions.
  1. +26 −2 kernel/pf_ring.c
View
@@ -110,6 +110,22 @@
#include <linux/pci.h>
#include <asm/shmparam.h>
#ifndef UTS_RELEASE
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#include <linux/utsrelease.h>
#else
#include <generated/utsrelease.h>
#endif
#endif
#ifdef UTS_UBUNTU_RELEASE_ABI
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,0))
#undef UTS_UBUNTU_RELEASE_ABI
#else
#define UBUNTU_VERSION_CODE (LINUX_VERSION_CODE & ~0xFF)
#endif
#endif
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
#define I82599_HW_FILTERING_SUPPORT
#endif
@@ -6945,7 +6961,11 @@ static int ring_setsockopt(struct socket *sock,
if (unlikely(enable_debug))
printk("[PF_RING] BPF filter (len = %u)\n", fprog.len);
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)) /* FIXX ubuntu only */
#if (defined(UTS_UBUNTU_RELEASE_ABI) && (\
UBUNTU_VERSION_CODE == KERNEL_VERSION(4,2,0) || \
(UBUNTU_VERSION_CODE == KERNEL_VERSION(4,4,0) && UTS_UBUNTU_RELEASE_ABI > 21) || \
UBUNTU_VERSION_CODE > KERNEL_VERSION(4,4,0))) || \
(!defined(UTS_UBUNTU_RELEASE_ABI) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0))
ret = __sk_attach_filter(&fprog, pfr->sk, sock_owned_by_user(pfr->sk));
#else
ret = sk_attach_filter(&fprog, pfr->sk);
@@ -6959,7 +6979,11 @@ static int ring_setsockopt(struct socket *sock,
case SO_DETACH_FILTER:
if (unlikely(enable_debug))
printk("[PF_RING] Removing BPF filter\n");
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)) /* FIXX ubuntu only */
#if (defined(UTS_UBUNTU_RELEASE_ABI) && (\
UBUNTU_VERSION_CODE == KERNEL_VERSION(4,2,0) || \
(UBUNTU_VERSION_CODE == KERNEL_VERSION(4,4,0) && UTS_UBUNTU_RELEASE_ABI > 21) || \
UBUNTU_VERSION_CODE > KERNEL_VERSION(4,4,0))) || \
(!defined(UTS_UBUNTU_RELEASE_ABI) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0))
ret = __sk_detach_filter(pfr->sk, sock_owned_by_user(pfr->sk));
#else
ret = sk_detach_filter(pfr->sk);

0 comments on commit 0e4738d

Please sign in to comment.