Subject: [PATCH] ifdef knox ncm nf_conntrack_core.c
---
Index: net/netfilter/nf_conntrack_core.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
--- a/net/netfilter/nf_conntrack_core.c	(revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/net/netfilter/nf_conntrack_core.c	(date 1644158930000)
@@ -52,9 +52,11 @@
 #include <net/netfilter/nf_nat.h>
 #include <net/netfilter/nf_nat_core.h>
 #include <net/netfilter/nf_nat_helper.h>
+#ifdef CONFIG_KNOX_NCM
 /* START_OF_KNOX_NPA */
 #include <net/ncm.h>
 /* END_OF_KNOX_NPA */
+#endif
 
 #define NF_CONNTRACK_VERSION	"0.5.0"
 
@@ -252,7 +254,7 @@
 static void nf_ct_add_to_dying_list(struct nf_conn *ct)
 {
 	struct ct_pcpu *pcpu;
-
+#ifdef CONFIG_KNOX_NCM
 	/* START_OF_KNOX_NPA */
 	del_timer(&ct->npa_timeout);
 	/* send dying conntrack entry to collect data */
@@ -260,7 +262,7 @@
 		knox_collect_conntrack_data(ct, NCM_FLOW_TYPE_CLOSE, 10);
 	}
 	/* END_OF_KNOX_NPA */
-
+#endif
 	/* add this conntrack to the (per cpu) dying list */
 	ct->cpu = smp_processor_id();
 	pcpu = per_cpu_ptr(nf_ct_net(ct)->ct.pcpu_lists, ct->cpu);
@@ -429,7 +431,7 @@
 	return true;
 }
 EXPORT_SYMBOL_GPL(nf_ct_delete);
-
+#ifdef CONFIG_KNOX_NCM
 /* START_OF_KNOX_NPA */
 /* Use this function only if struct nf_conn->timeout is of type struct timer_list */
 static void death_by_timeout_npa(unsigned long ul_conntrack)
@@ -450,13 +452,15 @@
 	return;
 }
 /* END_OF_KNOX_NPA */
-
+#endif
 static void death_by_timeout(unsigned long ul_conntrack)
 {
+#ifdef CONFIG_KNOX_NCM
 	/* START_OF_KNOX_NPA */
 	struct nf_conn *tmp = (struct nf_conn *)ul_conntrack;
 	atomic_set(&tmp->intermediateFlow, 0);
 	del_timer(&tmp->npa_timeout);
+#endif
 	/* END_OF_KNOX_NPA */
 	nf_ct_delete((struct nf_conn *)ul_conntrack, 0, 0);
 }
@@ -863,10 +867,11 @@
 		     gfp_t gfp, u32 hash)
 {
 	struct nf_conn *ct;
+#ifdef CONFIG_KNOX_NCM
 	/* START_OF_KNOX_NPA */
 	struct timespec open_timespec;
 	/* END_OF_KNOX_NPA */
-	
+#endif
 	if (unlikely(!nf_conntrack_hash_rnd)) {
 		init_nf_conntrack_hash_rnd();
 		/* recompute the hash as nf_conntrack_hash_rnd is initialized */
@@ -894,6 +899,7 @@
 		goto out;
 
 	spin_lock_init(&ct->lock);
+#ifdef CONFIG_KNOX_NCM
 	/* START_OF_KNOX_NPA */
 	/* initialize the conntrack structure members when memory is allocated */
 	if (ct != NULL) {
@@ -916,6 +922,7 @@
 		atomic_set(&ct->intermediateFlow, 0);
 	}
 	/* END_OF_KNOX_NPA */
+#endif
 	ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig;
 	ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode.pprev = NULL;
 	ct->tuplehash[IP_CT_DIR_REPLY].tuple = *repl;
