From 25086fbac36f608664dd803f68fa9c926fa8ac44 Mon Sep 17 00:00:00 2001 From: Sean Khan Date: Sun, 25 May 2025 15:36:03 -0400 Subject: [PATCH] treewide: Additional fixes for kernel 6.12 + GCC 15.1 Signed-off-by: Sean Khan --- ...5-nss-clients-add-kernel-6.6-support.patch | 2 +- .../0031-kernel-6.12-support.patch | 116 ++++++++++++++++++ .../patches/0031-kernel-6.12-support.patch | 28 ++--- ...-nss-drv-add-support-for-kernel-6.12.patch | 9 ++ 4 files changed, 140 insertions(+), 15 deletions(-) diff --git a/qca-nss-clients/patches-11.4/0025-nss-clients-add-kernel-6.6-support.patch b/qca-nss-clients/patches-11.4/0025-nss-clients-add-kernel-6.6-support.patch index f24f9fc..e6b8682 100644 --- a/qca-nss-clients/patches-11.4/0025-nss-clients-add-kernel-6.6-support.patch +++ b/qca-nss-clients/patches-11.4/0025-nss-clients-add-kernel-6.6-support.patch @@ -260,7 +260,7 @@ return -EFAULT; --- a/netlink/nss_nl.c +++ b/netlink/nss_nl.c -@@ -462,7 +462,11 @@ struct nss_nlcmn *nss_nl_get_msg(struct +@@ -463,7 +463,11 @@ struct nss_nlcmn *nss_nl_get_msg(struct /* * validate the common message header version & magic */ diff --git a/qca-nss-clients/patches-11.4/0031-kernel-6.12-support.patch b/qca-nss-clients/patches-11.4/0031-kernel-6.12-support.patch index 33fba8c..1dd6888 100644 --- a/qca-nss-clients/patches-11.4/0031-kernel-6.12-support.patch +++ b/qca-nss-clients/patches-11.4/0031-kernel-6.12-support.patch @@ -30,6 +30,16 @@ int write, void __user *buffer, size_t *lenp, loff_t *ppos) { +@@ -1593,8 +1593,7 @@ static struct ctl_table nss_bridge_mgr_t + .maxlen = sizeof(char) * IFNAMSIZ, + .mode = 0644, + .proc_handler = &nss_bridge_mgr_wan_intf_del_handler, +- }, +- { } ++ } + }; + + /* --- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c +++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c @@ -284,7 +284,11 @@ void nss_dtlsmgr_ctx_dev_rx_outer(struct @@ -269,6 +279,36 @@ int write, void __user *buffer, size_t *lenp, loff_t *ppos) { +@@ -985,8 +989,7 @@ static struct ctl_table nss_connmgr_l2tp + .maxlen = L2TP_SYSCTL_STR_LEN_MAX, + .mode = 0644, + .proc_handler = &nss_connmgr_l2tpv2_proc_handler, +- }, +- { } ++ } + }; + + /* +@@ -997,8 +1000,7 @@ static struct ctl_table nss_connmgr_l2tp + .procname = "l2tpv2", + .mode = 0555, + .child = nss_connmgr_l2tpv2_table, +- }, +- { } ++ } + }; + + /* +@@ -1009,8 +1011,7 @@ static struct ctl_table nss_connmgr_l2tp + .procname = "nss", + .mode = 0555, + .child = nss_connmgr_l2tpv2_dir, +- }, +- { } ++ } + }; + #endif + --- a/l2tp/l2tpv2/nss_l2tpv2_stats.c +++ b/l2tp/l2tpv2/nss_l2tpv2_stats.c @@ -129,7 +129,11 @@ void nss_l2tpv2_update_dev_stats(struct @@ -321,6 +361,16 @@ { int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); +@@ -688,8 +688,7 @@ static struct ctl_table nss_match_table[ + .maxlen = sizeof(nss_match_data), + .mode = 0400, + .proc_handler = &nss_match_cmd_procfs_read_help, +- }, +- { } ++ } + }; + + static struct ctl_table_header *nss_match_ctl_header; --- a/mirror/nss_mirror_ctl.c +++ b/mirror/nss_mirror_ctl.c @@ -132,7 +132,7 @@ static int nss_mirror_ctl_get_netdev_by_ @@ -350,6 +400,16 @@ void __user *buf, size_t *lenp, loff_t *ppos) { char *buffer, *pfree; +@@ -914,8 +914,7 @@ static struct ctl_table nss_mirror_table + .maxlen = sizeof(nss_mirror_config_data), + .mode = 0644, + .proc_handler = &nss_mirror_ctl_config_handler, +- }, +- { } ++ } + }; + + /* --- a/netlink/nss_nlipv4.c +++ b/netlink/nss_nlipv4.c @@ -129,7 +129,11 @@ static struct neighbour *nss_nlipv4_get_ @@ -454,6 +514,20 @@ if (unlikely(IS_ERR(rt))) { nss_ovpnmgr_warn("%px: Failed to find IPv4 route.\n", skb); tun->outer.stats.host_pkt_drop++; +--- a/openvpn/src/nss_ovpnmgr_app.c ++++ b/openvpn/src/nss_ovpnmgr_app.c +@@ -51,7 +51,11 @@ static struct net_device *nss_ovpnmgr_ap + struct rtable *rt4; + + if (rt->ip_version == IPVERSION) { ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0) + rt4 = ip_route_output(&init_net, rt->ip_addr[0], 0, 0, 0); ++#else ++ rt4 = ip_route_output(&init_net, rt->ip_addr[0], 0, 0, 0, 0); ++#endif + if (IS_ERR(rt4)) { + return NULL; + } --- a/tunipip6/nss_connmgr_tunipip6.c +++ b/tunipip6/nss_connmgr_tunipip6.c @@ -174,7 +174,11 @@ static void nss_tunipip6_encap_exception @@ -560,6 +634,16 @@ { int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); +@@ -445,8 +445,7 @@ static struct ctl_table nss_tunipip6_tab + .maxlen = sizeof(nss_tunipip6_data), + .mode = 0400, + .proc_handler = &nss_tunipip6_cmd_procfs_read_help, +- }, +- { } ++ } + }; + + static struct ctl_table_header *nss_tunipip6_ctl_header; --- a/vlan/nss_vlan_mgr.c +++ b/vlan/nss_vlan_mgr.c @@ -1549,7 +1549,7 @@ static int nss_vlan_mgr_update_ppe_tpid( @@ -571,6 +655,16 @@ int write, void __user *buffer, size_t *lenp, loff_t *ppos) { +@@ -1577,8 +1577,7 @@ static struct ctl_table nss_vlan_table[] + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &nss_vlan_mgr_tpid_proc_handler, +- }, +- { } ++ } + }; + + /* --- a/nss_qdisc/nss_htb.c +++ b/nss_qdisc/nss_htb.c @@ -647,7 +647,11 @@ static int nss_htb_graft_class(struct Qd @@ -718,3 +812,25 @@ nss_qdisc_info("Detaching old: %px\n", *old); nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag; +--- a/netlink/nss_nldtls.c ++++ b/netlink/nss_nldtls.c +@@ -1090,7 +1090,7 @@ static ssize_t nss_nldtls_tunnel_stats_r + list_for_each_entry(entry, &gbl_ctx.dtls_list_head, list) { + spin_lock_bh(&gbl_ctx.lock); + memcpy(&stats, &entry->stats, sizeof(stats)); +- strlcpy(dev_name, entry->dev_name, IFNAMSIZ); ++ strscpy(dev_name, entry->dev_name, IFNAMSIZ); + spin_unlock_bh(&gbl_ctx.lock); + + size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n--------------------------------"); +--- a/netlink/nss_nlipsec.c ++++ b/netlink/nss_nlipsec.c +@@ -391,7 +391,7 @@ static int nss_nlipsec_op_create_tunnel( + * the tunnel I/F name into the same rule and send it + * as part of the response for the create operation + */ +- strlcpy(nl_rule->ifname, dev->name, IFNAMSIZ); ++ strscpy(nl_rule->ifname, dev->name, IFNAMSIZ); + + /* + * Send to userspace diff --git a/qca-nss-clients/patches/0031-kernel-6.12-support.patch b/qca-nss-clients/patches/0031-kernel-6.12-support.patch index 512968b..6ed21b8 100644 --- a/qca-nss-clients/patches/0031-kernel-6.12-support.patch +++ b/qca-nss-clients/patches/0031-kernel-6.12-support.patch @@ -514,6 +514,20 @@ if (unlikely(IS_ERR(rt))) { nss_ovpnmgr_warn("%px: Failed to find IPv4 route.\n", skb); tun->outer.stats.host_pkt_drop++; +--- a/openvpn/src/nss_ovpnmgr_app.c ++++ b/openvpn/src/nss_ovpnmgr_app.c +@@ -51,7 +51,11 @@ static struct net_device *nss_ovpnmgr_ap + struct rtable *rt4; + + if (rt->ip_version == IPVERSION) { ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0) + rt4 = ip_route_output(&init_net, rt->ip_addr[0], 0, 0, 0); ++#else ++ rt4 = ip_route_output(&init_net, rt->ip_addr[0], 0, 0, 0, 0); ++#endif + if (IS_ERR(rt4)) { + return NULL; + } --- a/tunipip6/nss_connmgr_tunipip6.c +++ b/tunipip6/nss_connmgr_tunipip6.c @@ -174,7 +174,11 @@ static void nss_tunipip6_encap_exception @@ -820,17 +834,3 @@ /* * Send to userspace ---- a/openvpn/src/nss_ovpnmgr_app.c -+++ b/openvpn/src/nss_ovpnmgr_app.c -@@ -51,7 +51,11 @@ static struct net_device *nss_ovpnmgr_ap - struct rtable *rt4; - - if (rt->ip_version == IPVERSION) { -+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0) - rt4 = ip_route_output(&init_net, rt->ip_addr[0], 0, 0, 0); -+#else -+ rt4 = ip_route_output(&init_net, rt->ip_addr[0], 0, 0, 0, 0); -+#endif - if (IS_ERR(rt4)) { - return NULL; - } diff --git a/qca-nss-drv/patches/0026-nss-drv-add-support-for-kernel-6.12.patch b/qca-nss-drv/patches/0026-nss-drv-add-support-for-kernel-6.12.patch index bc5533a..3c836ae 100644 --- a/qca-nss-drv/patches/0026-nss-drv-add-support-for-kernel-6.12.patch +++ b/qca-nss-drv/patches/0026-nss-drv-add-support-for-kernel-6.12.patch @@ -524,6 +524,15 @@ int write, void __user *buffer, size_t *lenp, loff_t *ppos) { +@@ -998,7 +998,7 @@ static int nss_n2h_wifi_payloads_handler + * nss_n2h_get_qos_mem_size_cfg_handler() + * Gets the QoS memory pool size + */ +-static int nss_n2h_get_qos_mem_size_cfg_handler(struct ctl_table *ctl, ++static int nss_n2h_get_qos_mem_size_cfg_handler(compat_const struct ctl_table *ctl, + int write, void __user *buffer, + size_t *lenp, loff_t *ppos) + { @@ -1281,7 +1281,7 @@ failure: * nss_mitigation_handler() * Enable NSS MITIGATION