nss-packages-qosmio/qca-nss-ecm/patches/0023-nss-ecm-add-kernel-6.12-support.patch
Sean Khan 6f823a2b34 treewide: Initial support for kernel 6.12 + GCC 15.1
Signed-off-by: Sean Khan <datapronix@protonmail.com>
2025-05-08 23:12:18 -04:00

483 lines
17 KiB
Diff

--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -1278,7 +1278,11 @@ static bool ecm_interface_find_route_by_
* it is using to communicate with that IP address.
*/
ECM_IP_ADDR_TO_NIN4_ADDR(be_addr, addr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
ecm_rt->rt.rtv4 = ip_route_output(&init_net, be_addr, 0, 0, 0);
+#else
+ ecm_rt->rt.rtv4 = ip_route_output(&init_net, be_addr, 0, 0, 0, 0);
+#endif
if (IS_ERR(ecm_rt->rt.rtv4)) {
DEBUG_TRACE("No output route to: %pI4n\n", &be_addr);
return false;
@@ -1469,7 +1473,11 @@ struct neighbour *ecm_interface_ipv4_nei
__be32 ipv4_addr;
ECM_IP_ADDR_TO_NIN4_ADDR(ipv4_addr, addr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, ipv4_addr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, ipv4_addr, 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
return NULL;
}
@@ -8274,8 +8282,13 @@ int ecm_interface_wifi_event_stop(void)
* ecm_interface_igs_enabled_handler()
* IGS enabled check sysctl node handler.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
static int ecm_interface_igs_enabled_handler(struct ctl_table *ctl, int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
+#else
+static int ecm_interface_igs_enabled_handler(const struct ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
int current_value;
@@ -8315,7 +8328,11 @@ static int ecm_interface_igs_enabled_han
* ecm_interface_src_check_handler()
* Source interface check sysctl node handler.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
static int ecm_interface_src_check_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#else
+static int ecm_interface_src_check_handler(const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
int current_value;
@@ -8369,7 +8386,6 @@ static struct ctl_table ecm_interface_ta
.proc_handler = &ecm_interface_igs_enabled_handler,
},
#endif
- { }
};
#ifdef ECM_INTERFACE_IPSEC_GLUE_LAYER_SUPPORT_ENABLE
--- a/ecm_db/ecm_db_connection.c
+++ b/ecm_db/ecm_db_connection.c
@@ -698,7 +698,7 @@ EXPORT_SYMBOL(ecm_db_connection_node_add
void ecm_db_connection_iface_name_get(struct ecm_db_connection_instance *ci, ecm_db_obj_dir_t dir, char *name_buffer)
{
DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", ci);
- strlcpy(name_buffer, ci->node[dir]->iface->name, IFNAMSIZ);
+ strscpy(name_buffer, ci->node[dir]->iface->name, IFNAMSIZ);
}
EXPORT_SYMBOL(ecm_db_connection_iface_name_get);
--- a/ecm_db/ecm_db_iface.c
+++ b/ecm_db/ecm_db_iface.c
@@ -247,7 +247,7 @@ static int ecm_db_iface_state_get_base(s
interface_identifier = ii->interface_identifier;
ae_interface_identifier = ii->ae_interface_identifier;
spin_lock_bh(&ecm_db_lock);
- strlcpy(name, ii->name, IFNAMSIZ);
+ strscpy(name, ii->name, IFNAMSIZ);
mtu = ii->mtu;
spin_unlock_bh(&ecm_db_lock);
@@ -1178,7 +1178,7 @@ void ecm_db_iface_interface_name_get(str
{
DEBUG_CHECK_MAGIC(ii,
ECM_DB_IFACE_INSTANCE_MAGIC, "%px: magic failed", ii);
- strlcpy(name_buffer, ii->name, IFNAMSIZ);
+ strscpy(name_buffer, ii->name, IFNAMSIZ);
}
EXPORT_SYMBOL(ecm_db_iface_interface_name_get);
@@ -2708,7 +2708,7 @@ void ecm_db_iface_add_ethernet(struct ec
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2760,7 +2760,7 @@ void ecm_db_iface_add_lag(struct ecm_db_
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2811,7 +2811,7 @@ void ecm_db_iface_add_bridge(struct ecm_
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2862,7 +2862,7 @@ void ecm_db_iface_add_ovs_bridge(struct
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2913,7 +2913,7 @@ void ecm_db_iface_add_macvlan(struct ecm
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2964,7 +2964,7 @@ void ecm_db_iface_add_vlan(struct ecm_db
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3018,7 +3018,7 @@ void ecm_db_iface_add_map_t(struct ecm_d
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3070,7 +3070,7 @@ void ecm_db_iface_add_gre_tun(struct ecm
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3122,7 +3122,7 @@ void ecm_db_iface_add_pppoe(struct ecm_d
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3175,7 +3175,7 @@ void ecm_db_iface_add_pppol2tpv2(struct
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3228,7 +3228,7 @@ void ecm_db_iface_add_pptp(struct ecm_db
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3278,7 +3278,7 @@ void ecm_db_iface_add_unknown(struct ecm
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3327,7 +3327,7 @@ void ecm_db_iface_add_loopback(struct ec
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3386,7 +3386,7 @@ void ecm_db_iface_add_sit(struct ecm_db_
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3436,7 +3436,7 @@ void ecm_db_iface_add_tunipip6(struct ec
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3489,7 +3489,7 @@ void ecm_db_iface_add_ipsec_tunnel(struc
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3541,7 +3541,7 @@ void ecm_db_iface_add_rawip(struct ecm_d
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3592,7 +3592,7 @@ void ecm_db_iface_add_ovpn(struct ecm_db
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = type_info->tun_ifnum;
@@ -3643,7 +3643,7 @@ void ecm_db_iface_add_vxlan(struct ecm_d
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
--- a/frontends/ecm_front_end_common.c
+++ b/frontends/ecm_front_end_common.c
@@ -18,6 +18,7 @@
*/
#include <linux/version.h>
+#include <linux/vmalloc.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/debugfs.h>
@@ -895,7 +896,11 @@ int ecm_front_end_ppe_fse_enable_handler
* ecm_front_end_db_conn_limit_handler()
* Database connection limit sysctl node handler.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
int ecm_front_end_db_conn_limit_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_front_end_db_conn_limit_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
int current_value;
@@ -1114,7 +1119,11 @@ static int ecm_front_end_denied_ports_ha
* ecm_front_end_udp_denied_ports_handler()
* Proc handler function for UDP denied ports read/write operation.
*/
-static int ecm_front_end_udp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
+int ecm_front_end_udp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_front_end_udp_denied_ports_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
/*
* Usage:
@@ -1134,7 +1143,11 @@ static int ecm_front_end_udp_denied_port
* ecm_front_end_tcp_denied_ports_handler()
* Proc handler function for TCP denied ports read/write operation.
*/
-static int ecm_front_end_tcp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
+int ecm_front_end_tcp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_front_end_tcp_denied_ports_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
/*
* Usage:
@@ -1181,7 +1194,6 @@ static struct ctl_table ecm_front_end_sy
.mode = 0644,
.proc_handler = &ecm_front_end_tcp_denied_ports_handler,
},
- {}
};
/*
--- a/frontends/sfe/ecm_sfe_common.c
+++ b/frontends/sfe/ecm_sfe_common.c
@@ -308,7 +308,11 @@ void ecm_sfe_common_fast_xmit_set(uint32
* ecm_sfe_fast_xmit_enable_handler()
* Fast transmit sysctl node handler.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
int ecm_sfe_fast_xmit_enable_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_sfe_fast_xmit_enable_handler(const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
@@ -332,7 +336,11 @@ int ecm_sfe_fast_xmit_enable_handler(str
* ecm_sfe_fse_enable_handler()
* Sysctl to enable/disable FSE programming through ECM SFE frontend.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
int ecm_sfe_fse_enable_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_sfe_fse_enable_handler(const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
int current_val;
@@ -467,14 +475,13 @@ static struct ctl_table ecm_sfe_sysctl_t
.proc_handler = &ecm_sfe_mht_enable_handler,
},
#endif
- {}
};
/*
* ecm_sfe_sysctl_tbl_init()
* Register sysctl for SFE
*/
-int ecm_sfe_sysctl_tbl_init()
+int ecm_sfe_sysctl_tbl_init(void)
{
ecm_sfe_ctl_tbl_hdr = register_sysctl(ECM_FRONT_END_SYSCTL_PATH, ecm_sfe_sysctl_tbl);
if (!ecm_sfe_ctl_tbl_hdr) {
@@ -489,7 +496,7 @@ int ecm_sfe_sysctl_tbl_init()
* ecm_sfe_sysctl_tbl_exit()
* Unregister sysctl for SFE
*/
-void ecm_sfe_sysctl_tbl_exit()
+void ecm_sfe_sysctl_tbl_exit(void)
{
if (ecm_sfe_ctl_tbl_hdr) {
unregister_sysctl_table(ecm_sfe_ctl_tbl_hdr);
--- a/ecm_classifier_hyfi.c
+++ b/ecm_classifier_hyfi.c
@@ -437,7 +437,7 @@ static void ecm_classifier_hyfi_get_brid
struct net_device *master;
master = ecm_interface_get_and_hold_dev_master(dev);
if (master) {
- strlcpy(name_buffer, master->name, IFNAMSIZ);
+ strscpy(name_buffer, master->name, IFNAMSIZ);
dev_put(master);
dev_put(dev);
break;
@@ -841,13 +841,13 @@ struct ecm_classifier_hyfi_instance *ecm
/* one of the bridge name is null, typical
* routed connection. Consider valid bridge*/
if (strlen(to_bridge)) {
- strlcpy(chfi->bridge_name, to_bridge, IFNAMSIZ);
+ strscpy(chfi->bridge_name, to_bridge, IFNAMSIZ);
} else if (strlen(from_bridge)) {
- strlcpy(chfi->bridge_name, from_bridge, IFNAMSIZ);
+ strscpy(chfi->bridge_name, from_bridge, IFNAMSIZ);
}
} else if (!strncmp(to_bridge, from_bridge, IFNAMSIZ)) {
/* Pure bridge connection. Consider any one bridge */
- strlcpy(chfi->bridge_name, to_bridge, IFNAMSIZ);
+ strscpy(chfi->bridge_name, to_bridge, IFNAMSIZ);
} else {
/* multi-bridge connection */
chfi->multi_bridge_flow = true;
--- a/examples/ecm_pcc_test.c
+++ b/examples/ecm_pcc_test.c
@@ -716,9 +716,9 @@ static unsigned int ecm_pcc_test_update_
o_feature_flags = rule->feature_flags;
rule->accel = accel;
rule->feature_flags = feature_flags;
- strlcpy(rule->name, name, sizeof(rule->name));
- strlcpy(rule->mirror_info.tuple_mirror_dev, tuple_mirror_dev, IFNAMSIZ);
- strlcpy(rule->mirror_info.tuple_ret_mirror_dev, tuple_ret_mirror_dev, IFNAMSIZ);
+ strscpy(rule->name, name, sizeof(rule->name));
+ strscpy(rule->mirror_info.tuple_mirror_dev, tuple_mirror_dev, IFNAMSIZ);
+ strscpy(rule->mirror_info.tuple_ret_mirror_dev, tuple_ret_mirror_dev, IFNAMSIZ);
rule->ap_info.flow_ap_index = flow_ap_index;
rule->ap_info.return_ap_index = return_ap_index;
spin_unlock_bh(&ecm_pcc_test_rules_lock);
@@ -881,7 +881,7 @@ static unsigned int ecm_pcc_test_add_rul
if (!new_rule)
return 0;
- strlcpy(new_rule->name, name, sizeof(new_rule->name));
+ strscpy(new_rule->name, name, sizeof(new_rule->name));
new_rule->accel = accel;
new_rule->proto = proto;
new_rule->src_port = src_port;
@@ -892,8 +892,8 @@ static unsigned int ecm_pcc_test_add_rul
new_rule->dest_addr = *dest_addr;
new_rule->ipv = ipv;
new_rule->feature_flags = feature_flags;
- strlcpy(new_rule->mirror_info.tuple_mirror_dev, tuple_mirror_dev, IFNAMSIZ);
- strlcpy(new_rule->mirror_info.tuple_ret_mirror_dev, tuple_ret_mirror_dev, IFNAMSIZ);
+ strscpy(new_rule->mirror_info.tuple_mirror_dev, tuple_mirror_dev, IFNAMSIZ);
+ strscpy(new_rule->mirror_info.tuple_ret_mirror_dev, tuple_ret_mirror_dev, IFNAMSIZ);
new_rule->ap_info.flow_ap_index = flow_ap_index;
new_rule->ap_info.return_ap_index = return_ap_index;
INIT_LIST_HEAD(&new_rule->list);
@@ -1024,7 +1024,7 @@ static ssize_t ecm_pcc_test_rule_write(s
/*
* Convert fields
*/
- strlcpy(name, fields[0], sizeof(name));
+ strscpy(name, fields[0], sizeof(name));
name[sizeof(name) - 1] = 0;
if (sscanf(fields[1], "%u", &oper) != 1)
@@ -1072,9 +1072,9 @@ static ssize_t ecm_pcc_test_rule_write(s
return -EINVAL;
}
- strlcpy(tuple_mirror_dev, fields[11], IFNAMSIZ);
+ strscpy(tuple_mirror_dev, fields[11], IFNAMSIZ);
- strlcpy(tuple_ret_mirror_dev, fields[12], IFNAMSIZ);
+ strscpy(tuple_ret_mirror_dev, fields[12], IFNAMSIZ);
if (sscanf(fields[13], "%d", &flow_ap_index) != 1)
goto sscanf_read_error;
--- a/Makefile
+++ b/Makefile
@@ -541,4 +541,10 @@ endif
ccflags-y += -Wall -Werror
+# Kernel 6.12 compat headers
+ccflags-y += -I$(obj)/compat
+
+# GCC 15+ has stricter checks for prototypes and declarations. Silence them
+ccflags-y += -Wno-missing-prototypes -Wno-missing-declarations
+
obj ?= .
--- /dev/null
+++ b/compat/asm/unaligned.h
@@ -0,0 +1,13 @@
+/* Compatibility header for <asm/unaligned.h> moved to <linux/unaligned.h> in kernel 6.10+ */
+#ifndef _ASM_UNALIGNED_H
+#define _ASM_UNALIGNED_H
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,10,0)
+#include <linux/unaligned.h>
+#else
+#include_next <asm/unaligned.h>
+#endif
+
+#endif /* _ASM_UNALIGNED_H */