nss-packages-qosmio/qca-nss-ecm/patches/0006-treewide-rework-notifier-changes-for-5.15.patch
Qosmio 8d54d726c2 Move non-upstream NSS packages back into repo
To keep fork as closely synced with upstream, move NSS packages back
into repository. Not sure why they were moved out from my original fork.
* nss-firmware
* qca-nss-crypto
* qca-nss-cfi

Removed the following:
* mhz (already available in packages repo)
* qrtr (unecessary, and has been broken for years)

Also moved packages out of `qca` and back into root directory.
2024-02-19 01:35:04 -05:00

88 lines
2.9 KiB
Diff

From 0df0d3ffb4b6df09a28d233925b533de14be6f0e Mon Sep 17 00:00:00 2001
From: Bit Thief <bitthief@protonmail.ch>
Date: Tue, 4 Apr 2023 05:22:33 +0300
Subject: [PATCH] treewide: rework notifier changes for 5.15
---
ecm_conntrack_notifier.c | 35 +++++++++++++++--------------------
1 file changed, 15 insertions(+), 20 deletions(-)
--- a/ecm_conntrack_notifier.c
+++ b/ecm_conntrack_notifier.c
@@ -332,15 +332,8 @@ EXPORT_SYMBOL(ecm_conntrack_ipv4_event);
* ecm_conntrack_event()
* Callback event invoked when conntrack connection state changes, currently we handle destroy events to quickly release state
*/
-#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
-static int ecm_conntrack_event(struct notifier_block *this, unsigned long events, void *ptr)
-#else
-static int ecm_conntrack_event(unsigned int events, struct nf_ct_event *item)
-#endif
+static int ecm_conntrack_event(unsigned int events, const struct nf_ct_event *item)
{
-#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
- struct nf_ct_event *item = (struct nf_ct_event *)ptr;
-#endif
struct nf_conn *ct = item->ct;
/*
@@ -387,23 +380,17 @@ static int ecm_conntrack_event(unsigned
return NOTIFY_DONE;
}
-#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
-/*
- * struct notifier_block ecm_conntrack_notifier
- * Netfilter conntrack event system to monitor connection tracking changes
- */
-static struct notifier_block ecm_conntrack_notifier = {
- .notifier_call = ecm_conntrack_event,
-};
-#else
/*
* struct nf_ct_event_notifier ecm_conntrack_notifier
* Netfilter conntrack event system to monitor connection tracking changes
*/
static struct nf_ct_event_notifier ecm_conntrack_notifier = {
- .fcn = ecm_conntrack_event,
-};
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
+ .fcn = ecm_conntrack_event,
+#else
+ .ct_event = ecm_conntrack_event,
#endif
+};
#endif
/*
@@ -440,12 +427,16 @@ int ecm_conntrack_notifier_init(struct d
/*
* Eventing subsystem is available so we register a notifier hook to get fast notifications of expired connections
*/
- result = nf_conntrack_register_notifier(&init_net, &ecm_conntrack_notifier);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
+ result = nf_conntrack_register_notifier(&init_net, &ecm_conntrack_notifier);
if (result < 0) {
DEBUG_ERROR("Can't register nf notifier hook.\n");
debugfs_remove_recursive(ecm_conntrack_notifier_dentry);
return result;
}
+#else
+ nf_conntrack_register_notifier(&init_net, &ecm_conntrack_notifier);
+#endif
/*
* Hold netns reference to keep the basic conntrack alive and
@@ -487,7 +478,11 @@ void ecm_conntrack_notifier_exit(void)
#ifdef ECM_IPV6_ENABLE
nf_ct_netns_put(&init_net, NFPROTO_IPV6);
#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
nf_conntrack_unregister_notifier(&init_net, &ecm_conntrack_notifier);
+#else
+ nf_conntrack_unregister_notifier(&init_net);
+#endif
#endif
/*
* Remove the debugfs files recursively.