mirror of
https://github.com/openwrt/packages.git
synced 2025-12-21 17:04:32 +04:00
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 <ansuelsmth@gmail.com>
73 lines
2.3 KiB
Diff
73 lines
2.3 KiB
Diff
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))
|
|
@@ -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.
|
|
*/
|
|
- || ((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;
|
|
}
|
|
@@ -5664,15 +5676,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);
|
|
|