libpfring: bump version

This commit is contained in:
coolsnowwolf 2024-11-14 11:18:55 +08:00
parent 7b5a8f41fa
commit cf62b54812
6 changed files with 138 additions and 9 deletions

View File

@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=libpfring
PKG_VERSION:=8.0.0
PKG_RELEASE:=$(AUTORELEASE)
PKG_VERSION:=8.6.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/ntop/PF_RING/tar.gz/$(PKG_VERSION)?
PKG_HASH:=8e733899b736fe2536ef785b2b7d719abe652297fe7fe3a03fc495a87a9b6e82
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/PF_RING-$(PKG_VERSION)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/ntop/PF_RING
PKG_MIRROR_HASH:=da580f899de9ca73d2ab6958e2919415f70a0b8f22841083edf41aeb2c8995c6
PKG_MAINTAINER:=Banglang Huang <banglang.huang@foxmail.com>

View File

@ -1,6 +1,6 @@
--- a/userland/configure
+++ b/userland/configure
@@ -3875,12 +3875,6 @@ $as_echo "no" >&6; }
@@ -3873,12 +3873,6 @@ $as_echo "no" >&6; }
if test "$IS_FREEBSD" != "1" && test "$cross_compiling" != "yes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if r/w locks are supported" >&5
$as_echo_n "checking if r/w locks are supported... " >&6; }
@ -13,7 +13,7 @@
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -3893,7 +3887,7 @@ else
@@ -3891,7 +3885,7 @@ else
_ACEOF
@ -22,7 +22,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<_ACEOF
@@ -3907,7 +3901,6 @@ $as_echo "no" >&6; }
@@ -3905,7 +3899,6 @@ $as_echo "no" >&6; }
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext

View File

@ -0,0 +1,24 @@
--- a/kernel/pf_ring.c
+++ b/kernel/pf_ring.c
@@ -4713,8 +4713,8 @@ void reserve_memory(unsigned long base,
{
struct page *page, *page_end;
- page_end = virt_to_page(base + mem_len - 1);
- for(page = virt_to_page(base); page <= page_end; page++)
+ page_end = virt_to_page((void*)base + mem_len - 1);
+ for(page = virt_to_page((void*)base); page <= page_end; page++)
SetPageReserved(page);
}
@@ -4722,8 +4722,8 @@ void unreserve_memory(unsigned long base
{
struct page *page, *page_end;
- page_end = virt_to_page(base + mem_len - 1);
- for(page = virt_to_page(base); page <= page_end; page++)
+ page_end = virt_to_page((void*)base + mem_len - 1);
+ for(page = virt_to_page((void*)base); page <= page_end; page++)
ClearPageReserved(page);
}

View File

@ -0,0 +1,11 @@
--- a/kernel/pf_ring.c
+++ b/kernel/pf_ring.c
@@ -3903,7 +3903,7 @@ static int hash_pkt_cluster(ring_cluster
break;
}
/* else, fall through, because it's like 2-tuple for non-TCP packets */
-
+ fallthrough;
case cluster_per_flow_2_tuple:
case cluster_per_inner_flow_2_tuple:
flags |= mask_2_tuple;

View File

@ -0,0 +1,72 @@
From 1b7780e9ecb46c6a5bbc8a831778a683f8ae80d8 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Mon, 18 Mar 2024 10:03:43 +0100
Subject: [PATCH] kernel: pf_ring: better define sa_data size
pfring_mod_bind() needs to specify the interface
name using struct sockaddr that is defined as
struct sockaddr { ushort sa_family; char sa_data[14]; };
so the total interface name length is 13 chars (plus \0 trailer).
Since sa_data size is arbitrary, define a more precise size for
PF_RING socket use.
This fix some compilation error with fortify string and makes the array
handling more deterministic.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
kernel/pf_ring.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
--- a/kernel/pf_ring.c
+++ b/kernel/pf_ring.c
@@ -158,6 +158,18 @@
#endif
#endif
+/*
+ pfring_mod_bind() needs to specify the interface
+ name using struct sockaddr that is defined as
+
+ struct sockaddr { ushort sa_family; char sa_data[14]; };
+
+ so the total interface name length is 13 chars (plus \0 trailer).
+ Since sa_data size is arbitrary, define a more precise size for
+ PF_RING socket use.
+*/
+#define RING_SA_DATA_LEN 14
+
/* ************************************************* */
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
@@ -1032,7 +1044,7 @@ pf_ring_device *pf_ring_device_name_look
so the total interface name length is 13 chars (plus \0 trailer).
The check below is to trap this case.
*/
- || ((l >= 13) && (strncmp(dev_ptr->device_name, name, 13) == 0)))
+ || ((l >= RING_SA_DATA_LEN - 1) && (strncmp(dev_ptr->device_name, name, RING_SA_DATA_LEN - 1) == 0)))
&& device_net_eq(dev_ptr, net))
return dev_ptr;
}
@@ -5605,15 +5617,15 @@ static int ring_bind(struct socket *sock
#ifndef RING_USE_SOCKADDR_LL
} else if (addr_len == sizeof(struct sockaddr)) { /* Deprecated */
- char name[sizeof(sa->sa_data)+1];
+ char name[RING_SA_DATA_LEN];
if (sa->sa_family != PF_RING)
return(-EINVAL);
- memcpy(name, sa->sa_data, sizeof(sa->sa_data));
+ memcpy(name, sa->sa_data, RING_SA_DATA_LEN - 1);
/* Add trailing zero if missing */
- name[sizeof(name)-1] = '\0';
+ name[RING_SA_DATA_LEN-1] = '\0';
debug_printk(2, "searching device %s\n", name);

View File

@ -0,0 +1,22 @@
From 5557b6ffe8d4eeb93532d043649b40eb10120bf7 Mon Sep 17 00:00:00 2001
From: Gavin <gavin.bravery@jagsiacs.co.uk>
Date: Wed, 25 Oct 2023 11:40:50 +0100
Subject: [PATCH] Update pf_ring.c
Change to remove .sendpage assignment, as that attribute seems to have gone away in 6.5.3 kernel.
---
kernel/pf_ring.c | 2 ++
1 file changed, 2 insertions(+)
--- a/kernel/pf_ring.c
+++ b/kernel/pf_ring.c
@@ -8470,7 +8470,9 @@ static struct proto_ops ring_ops = {
.getname = sock_no_getname,
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(6,5,3))
.sendpage = sock_no_sendpage,
+ #endif
/* Now the operations that really occur. */
.release = ring_release,