libpfring: backport patches fixing compilation warning on 6.12+
authorChristian Marangi <[email protected]>
Mon, 18 Aug 2025 15:29:48 +0000 (17:29 +0200)
committerTianling Shen <[email protected]>
Fri, 22 Aug 2025 17:10:39 +0000 (01:10 +0800)
Backport patches fixing compilation warning on 6.12+ kernel version.

  CC [M]  /home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.o
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:284:1: error: 'static' is not at beginning of declaration [-Werror=old-style-declaration]
  284 | const static ip_addr ip_zero = { IN6ADDR_ANY_INIT };
      | ^~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:467:7: error: no previous prototype for 'get_num_rx_queues' [-Werror=missing-prototypes]
  467 | u_int get_num_rx_queues(struct net_device *dev)
      |       ^~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:485:7: error: no previous prototype for 'lock_rss_queues' [-Werror=missing-prototypes]
  485 | u_int lock_rss_queues(struct net_device *dev)
      |       ^~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:744:14: error: no previous prototype for 'netns_lookup' [-Werror=missing-prototypes]
  744 | pf_ring_net *netns_lookup(struct net *net) {
      |              ^~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:762:14: error: no previous prototype for 'netns_add' [-Werror=missing-prototypes]
  762 | pf_ring_net *netns_add(struct net *net) {
      |              ^~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:1017:17: error: no previous prototype for 'pf_ring_device_ifindex_lookup' [-Werror=missing-prototypes]
 1017 | pf_ring_device *pf_ring_device_ifindex_lookup(struct net *net, int ifindex) {
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:1031:17: error: no previous prototype for 'pf_ring_device_name_lookup' [-Werror=missing-prototypes]
 1031 | pf_ring_device *pf_ring_device_name_lookup(struct net *net /* namespace */, char *name) {
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:3467:5: error: no previous prototype for 'check_perfect_rules' [-Werror=missing-prototypes]
 3467 | int check_perfect_rules(struct sk_buff *skb,
      |     ^~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:3541:5: error: no previous prototype for 'check_wildcard_rules' [-Werror=missing-prototypes]
 3541 | int check_wildcard_rules(struct sk_buff *skb,
      |     ^~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:3657:5: error: no previous prototype for 'bpf_filter_skb' [-Werror=missing-prototypes]
 3657 | int bpf_filter_skb(struct sk_buff *skb,
      |     ^~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:3711:5: error: no previous prototype for 'sample_packet' [-Werror=missing-prototypes]
 3711 | int sample_packet(struct pf_ring_socket *pfr) {
      |     ^~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:3731:11: error: no previous prototype for 'default_rehash_rss_func' [-Werror=missing-prototypes]
 3731 | u_int32_t default_rehash_rss_func(struct sk_buff *skb, struct pfring_pkthdr *hdr)
      |           ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:4477:6: error: no previous prototype for 'register_device_handler' [-Werror=missing-prototypes]
 4477 | void register_device_handler(void)
      |      ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:4486:6: error: no previous prototype for 'unregister_device_handler' [-Werror=missing-prototypes]
 4486 | void unregister_device_handler(void)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:4724:6: error: no previous prototype for 'reserve_memory' [-Werror=missing-prototypes]
 4724 | void reserve_memory(unsigned long base, unsigned long mem_len)
      |      ^~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:4733:6: error: no previous prototype for 'unreserve_memory' [-Werror=missing-prototypes]
 4733 | void unreserve_memory(unsigned long base, unsigned long mem_len)
      |      ^~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:6038:14: error: no previous prototype for 'ring_poll' [-Werror=missing-prototypes]
 6038 | unsigned int ring_poll(struct file *file,
      |              ^~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:6130:23: error: no previous prototype for 'cluster_lookup' [-Werror=missing-prototypes]
 6130 | ring_cluster_element *cluster_lookup(u_int32_t cluster_id) {
      |                       ^~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:6149:5: error: no previous prototype for 'get_first_available_cluster_queue' [-Werror=missing-prototypes]
 6149 | int get_first_available_cluster_queue(ring_cluster_element *el)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:6162:24: error: no previous prototype for 'get_first_cluster_consumer' [-Werror=missing-prototypes]
 6162 | struct pf_ring_socket *get_first_cluster_consumer(ring_cluster_element *el)
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:6179:5: error: no previous prototype for 'add_sock_to_cluster_list' [-Werror=missing-prototypes]
 6179 | int add_sock_to_cluster_list(ring_cluster_element *el, struct sock *sk, u_int16_t consumer_id)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:6231:5: error: no previous prototype for 'remove_from_cluster_list' [-Werror=missing-prototypes]
 6231 | int remove_from_cluster_list(struct ring_cluster *cluster_ptr, struct sock *sock)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:6840:5: error: no previous prototype for 'setSocketStats' [-Werror=missing-prototypes]
 6840 | int setSocketStats(struct pf_ring_socket *pfr)
      |     ^~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:8266:6: error: no previous prototype for 'pf_ring_zc_dev_register' [-Werror=missing-prototypes]
 8266 | void pf_ring_zc_dev_register(zc_dev_callbacks *callbacks,
      |      ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:8351:6: error: no previous prototype for 'pf_ring_zc_dev_unregister' [-Werror=missing-prototypes]
 8351 | void pf_ring_zc_dev_unregister(struct net_device *dev, u_int channel_id)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:8505:6: error: no previous prototype for 'remove_device_from_proc' [-Werror=missing-prototypes]
 8505 | void remove_device_from_proc(pf_ring_net *netns, pf_ring_device *dev_ptr) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:8540:6: error: no previous prototype for 'remove_device_from_ring_list' [-Werror=missing-prototypes]
 8540 | void remove_device_from_ring_list(struct net_device *dev)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:8607:6: error: no previous prototype for 'add_device_to_proc' [-Werror=missing-prototypes]
 8607 | void add_device_to_proc(pf_ring_net *netns, pf_ring_device *dev_ptr) {
      |      ^~~~~~~~~~~~~~~~~~
/home/runner/work/openwrt-rebuilder/openwrt-rebuilder/original/build/SNAPSHOT/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/libpfring-8.6.1/kernel/pf_ring.c:8637:5: error: no previous prototype for 'add_device_to_ring_list' [-Werror=missing-prototypes]
 8637 | int add_device_to_ring_list(struct net_device *dev, int32_t dev_index)
      |     ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

While at it also refresh all the previous patch.

Signed-off-by: Christian Marangi <[email protected]>
libs/libpfring/Makefile
libs/libpfring/patches/002-Fix-missing-prototypes.patch [new file with mode: 0644]
libs/libpfring/patches/003-kernel-pf_ring-fix-old-style-declaration-compilation.patch [new file with mode: 0644]
libs/libpfring/patches/010-gcc14.patch
libs/libpfring/patches/100-fix-compilation-warning.patch
libs/libpfring/patches/101-kernel-pf_ring-better-define-sa_data-size.patch
libs/libpfring/patches/102-remove-sendpage.patch

index 969d27f5a8d38e0632f7f66048b11b2e0c94ae9d..eeb20f0c9f7ce0316dace83f75e329ee95c2b3c4 100644 (file)
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=libpfring
 PKG_VERSION:=8.6.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_VERSION:=$(PKG_VERSION)
diff --git a/libs/libpfring/patches/002-Fix-missing-prototypes.patch b/libs/libpfring/patches/002-Fix-missing-prototypes.patch
new file mode 100644 (file)
index 0000000..b71d516
--- /dev/null
@@ -0,0 +1,77 @@
+From 3b76a8ae22874b76759da9e188082138a9a03d41 Mon Sep 17 00:00:00 2001
+From: Alfredo Cardigliano <[email protected]>
+Date: Tue, 30 Apr 2024 09:30:24 +0000
+Subject: [PATCH] Fix missing prototypes
+
+---
+ kernel/pf_ring.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 59 insertions(+)
+
+--- a/kernel/pf_ring.c
++++ b/kernel/pf_ring.c
+@@ -443,6 +443,65 @@ MODULE_PARM_DESC(transparent_mode,
+ /* ********************************** */
++u_int32_t get_num_rx_queues(struct net_device *dev);
++u_int32_t lock_rss_queues(struct net_device *dev);
++pf_ring_net *netns_lookup(struct net *net);
++pf_ring_net *netns_add(struct net *net);
++pf_ring_device *pf_ring_device_ifindex_lookup(struct net *net, int ifindex);
++pf_ring_device *pf_ring_device_name_lookup(struct net *net /* namespace */, char *name);
++int check_perfect_rules(struct sk_buff *skb,
++                        struct pf_ring_socket *pfr,
++                        struct pfring_pkthdr *hdr,
++                        int *fwd_pkt,
++                        int displ,
++                        sw_filtering_hash_bucket **p_hash_bucket);
++int check_wildcard_rules(struct sk_buff *skb,
++                         struct pf_ring_socket *pfr,
++                         struct pfring_pkthdr *hdr,
++                         int *fwd_pkt,
++                         int displ);
++int bpf_filter_skb(struct sk_buff *skb,
++                   struct pf_ring_socket *pfr,
++                   int displ);
++int sample_packet(struct pf_ring_socket *pfr);
++u_int32_t default_rehash_rss_func(struct sk_buff *skb, struct pfring_pkthdr *hdr);
++void set_ring_num_channels(struct pf_ring_socket *pfr, u_int32_t num_rx_channels);
++void register_device_handler(void);
++void unregister_device_handler(void);
++void reserve_memory(unsigned long base, unsigned long mem_len);
++void unreserve_memory(unsigned long base, unsigned long mem_len);
++unsigned int ring_poll(struct file *file,
++                       struct socket *sock, poll_table *wait);
++ring_cluster_element *cluster_lookup(u_int32_t cluster_id);
++int get_first_available_cluster_queue(ring_cluster_element *el);
++struct pf_ring_socket *get_first_cluster_consumer(ring_cluster_element *el);
++int add_sock_to_cluster_list(ring_cluster_element *el, struct sock *sk, u_int16_t consumer_id);
++int remove_from_cluster_list(struct ring_cluster *cluster_ptr, struct sock *sock);
++int setSocketStats(struct pf_ring_socket *pfr);
++void pf_ring_zc_dev_register(zc_dev_callbacks *callbacks,
++                             zc_dev_ring_info *rx_info,
++                             zc_dev_ring_info *tx_info,
++                             void *rx_descr_packet_memory,
++                             void *tx_descr_packet_memory,
++                             void *phys_card_memory,
++                             u_int32_t phys_card_memory_len,
++                             u_int32_t channel_id,
++                             struct net_device *dev,
++                             struct device *hwdev,
++                             zc_dev_model device_model,
++                             u_char *device_address,
++                             wait_queue_head_t *packet_waitqueue,
++                             u_int8_t *interrupt_received,
++                             void *rx_adapter,
++                             void *tx_adapter);
++void pf_ring_zc_dev_unregister(struct net_device *dev, u_int32_t channel_id);
++void remove_device_from_proc(pf_ring_net *netns, pf_ring_device *dev_ptr);
++void remove_device_from_ring_list(struct net_device *dev);
++void add_device_to_proc(pf_ring_net *netns, pf_ring_device *dev_ptr);
++int add_device_to_ring_list(struct net_device *dev, int32_t dev_index);
++
++/* ********************************** */
++
+ #define MIN_QUEUED_PKTS      64
+ #define MAX_QUEUE_LOOPS      64
diff --git a/libs/libpfring/patches/003-kernel-pf_ring-fix-old-style-declaration-compilation.patch b/libs/libpfring/patches/003-kernel-pf_ring-fix-old-style-declaration-compilation.patch
new file mode 100644 (file)
index 0000000..c22ad46
--- /dev/null
@@ -0,0 +1,33 @@
+From f6d56c4a0cceffa0a3def7e32a0f7c470e86d652 Mon Sep 17 00:00:00 2001
+From: Christian Marangi <[email protected]>
+Date: Mon, 18 Aug 2025 17:12:50 +0200
+Subject: [PATCH] kernel: pf_ring: fix old-style-declaration compilation
+ warning
+
+New kernel linux from 6.12 enabled new compilation Warning and this
+cause errors if -Werror is enabled.
+
+There is currently one line that triggers the following warning:
+
+pf_ring.c:284:1: error: 'static' is not at beginning of declaration [-Werror=old-style-declaration]
+  284 | const static ip_addr ip_zero = { IN6ADDR_ANY_INIT };
+      | ^~~~~
+
+Implement the trivial fix to mute the warning.
+
+Signed-off-by: Christian Marangi <[email protected]>
+---
+ kernel/pf_ring.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/pf_ring.c
++++ b/kernel/pf_ring.c
+@@ -269,7 +269,7 @@ static inline void printk_addr(u_int8_t
+ /* ************************************************* */
+-const static ip_addr ip_zero = { IN6ADDR_ANY_INIT };
++static const ip_addr ip_zero = { IN6ADDR_ANY_INIT };
+ static u_int8_t pfring_enabled = 1;
index c17dc85aa8915cc8933780c001b4a0539f7bca74..0baee841ebe0c8fcb55c760f7376cdb2bf6a03ba 100644 (file)
@@ -1,6 +1,6 @@
 --- a/kernel/pf_ring.c
 +++ b/kernel/pf_ring.c
-@@ -4713,8 +4713,8 @@ void reserve_memory(unsigned long base,
+@@ -4772,8 +4772,8 @@ void reserve_memory(unsigned long base,
  {
    struct page *page, *page_end;
  
@@ -11,7 +11,7 @@
      SetPageReserved(page);
  }
  
-@@ -4722,8 +4722,8 @@ void unreserve_memory(unsigned long base
+@@ -4781,8 +4781,8 @@ void unreserve_memory(unsigned long base
  {
    struct page *page, *page_end;
  
index 85393a2efbd851e216b35762c0d687e3e96d20d1..6ce8ee6e13bb22883e9ac6417d577a08ff01fc55 100644 (file)
@@ -1,6 +1,6 @@
 --- a/kernel/pf_ring.c
 +++ b/kernel/pf_ring.c
-@@ -3903,7 +3903,7 @@ static int hash_pkt_cluster(ring_cluster
+@@ -3962,7 +3962,7 @@ static int hash_pkt_cluster(ring_cluster
        break;
      }
      /* else, fall through, because it's like 2-tuple for non-TCP packets */
index 3045818fcf32a109390f6df090158998e512939d..b2644d0c8e9ce27ff0f0c09d498b8554e9f98c6c 100644 (file)
@@ -42,7 +42,7 @@ Signed-off-by: Christian Marangi <[email protected]>
  /* ************************************************* */
  
  #if(LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
-@@ -1032,7 +1044,7 @@ pf_ring_device *pf_ring_device_name_look
+@@ -1091,7 +1103,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.
           */
@@ -51,7 +51,7 @@ Signed-off-by: Christian Marangi <[email protected]>
         && device_net_eq(dev_ptr, net))
        return dev_ptr;
    }
-@@ -5605,15 +5617,15 @@ static int ring_bind(struct socket *sock
+@@ -5664,15 +5676,15 @@ static int ring_bind(struct socket *sock
  #ifndef RING_USE_SOCKADDR_LL
    } else if (addr_len == sizeof(struct sockaddr)) { /* Deprecated */
  
index a5ca50900ac2455be993548e93639495959571ad..1b74607694eddc419e4cc59bf5e3101fd3265b16 100644 (file)
@@ -10,7 +10,7 @@ Change to remove .sendpage assignment, as that attribute seems to have gone away
 
 --- a/kernel/pf_ring.c
 +++ b/kernel/pf_ring.c
-@@ -8470,7 +8470,9 @@ static struct proto_ops ring_ops = {
+@@ -8529,7 +8529,9 @@ static struct proto_ops ring_ops = {
    .getname = sock_no_getname,
    .listen = sock_no_listen,
    .shutdown = sock_no_shutdown,