mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
336 lines
12 KiB
Diff
336 lines
12 KiB
Diff
From 73345c87b28a473b35b57e673f8de963c3d73da1 Mon Sep 17 00:00:00 2001
|
|
From: Ansuel Smith <ansuelsmth@gmail.com>
|
|
Date: Wed, 19 May 2021 02:38:53 +0200
|
|
Subject: [PATCH] treewide: componentize the module even more
|
|
|
|
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
|
---
|
|
Makefile | 56 +++++++++++++++++++++++++-------
|
|
ecm_db/ecm_db_connection.c | 8 +++++
|
|
ecm_db/ecm_db_node.c | 4 +++
|
|
ecm_interface.c | 8 +++++
|
|
frontends/ecm_front_end_common.c | 7 ++++
|
|
5 files changed, 72 insertions(+), 11 deletions(-)
|
|
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -82,10 +82,18 @@ ccflags-$(ECM_INTERFACE_BOND_ENABLE) +=
|
|
# Define ECM_INTERFACE_PPPOE_ENABLE=y in order
|
|
# to enable support for PPPoE acceleration.
|
|
# #############################################################################
|
|
-ECM_INTERFACE_PPPOE_ENABLE=y
|
|
+ifndef $(ECM_INTERFACE_PPPOE_ENABLE)
|
|
+ ECM_INTERFACE_PPPOE_ENABLE=y
|
|
+endif
|
|
ccflags-$(ECM_INTERFACE_PPPOE_ENABLE) += -DECM_INTERFACE_PPPOE_ENABLE
|
|
|
|
# #############################################################################
|
|
+# Define ECM_INTERFACE_L2TPV2_PPTP_ENABLE=y in order
|
|
+# to enable support for l2tpv2 or PPTP detection.
|
|
+# #############################################################################
|
|
+ccflags-$(ECM_INTERFACE_L2TPV2_PPTP_ENABLE) += -DECM_INTERFACE_L2TPV2_PPTP_ENABLE
|
|
+
|
|
+# #############################################################################
|
|
# Define ECM_INTERFACE_L2TPV2_ENABLE=y in order
|
|
# to enable support for l2tpv2 acceleration.
|
|
# #############################################################################
|
|
@@ -118,6 +126,12 @@ ccflags-$(ECM_INTERFACE_PPP_ENABLE) += -
|
|
ccflags-$(ECM_INTERFACE_MAP_T_ENABLE) += -DECM_INTERFACE_MAP_T_ENABLE
|
|
|
|
# #############################################################################
|
|
+# Define ECM_INTERFACE_GRE_ENABLE=y in order
|
|
+# to enable support for GRE detection.
|
|
+# #############################################################################
|
|
+ccflags-$(ECM_INTERFACE_GRE_ENABLE) += -DECM_INTERFACE_GRE_ENABLE
|
|
+
|
|
+# #############################################################################
|
|
# Define ECM_INTERFACE_GRE_TAP_ENABLE=y in order
|
|
# to enable support for GRE TAP interface.
|
|
# #############################################################################
|
|
@@ -186,7 +200,9 @@ ccflags-$(ECM_INTERFACE_OVS_BRIDGE_ENABL
|
|
# #############################################################################
|
|
# Define ECM_INTERFACE_VLAN_ENABLE=y in order to enable support for VLAN
|
|
# #############################################################################
|
|
-ECM_INTERFACE_VLAN_ENABLE=y
|
|
+ifndef $(ECM_INTERFACE_VLAN_ENABLE)
|
|
+ ECM_INTERFACE_VLAN_ENABLE=y
|
|
+endif
|
|
ccflags-$(ECM_INTERFACE_VLAN_ENABLE) += -DECM_INTERFACE_VLAN_ENABLE
|
|
|
|
# #############################################################################
|
|
@@ -228,7 +244,9 @@ ccflags-$(ECM_CLASSIFIER_OVS_ENABLE) +=
|
|
# #############################################################################
|
|
# Define ECM_CLASSIFIER_MARK_ENABLE=y in order to enable mark classifier.
|
|
# #############################################################################
|
|
-ECM_CLASSIFIER_MARK_ENABLE=y
|
|
+ifndef $(ECM_CLASSIFIER_MARK_ENABLE)
|
|
+ ECM_CLASSIFIER_MARK_ENABLE=y
|
|
+endif
|
|
ecm-$(ECM_CLASSIFIER_MARK_ENABLE) += ecm_classifier_mark.o
|
|
ccflags-$(ECM_CLASSIFIER_MARK_ENABLE) += -DECM_CLASSIFIER_MARK_ENABLE
|
|
|
|
@@ -247,7 +265,9 @@ ccflags-$(ECM_CLASSIFIER_NL_ENABLE) += -
|
|
# #############################################################################
|
|
# Define ECM_CLASSIFIER_DSCP_ENABLE=y in order to enable DSCP classifier.
|
|
# #############################################################################
|
|
-ECM_CLASSIFIER_DSCP_ENABLE=y
|
|
+ifndef $(ECM_CLASSIFIER_DSCP_ENABLE)
|
|
+ ECM_CLASSIFIER_DSCP_ENABLE=y
|
|
+endif
|
|
ecm-$(ECM_CLASSIFIER_DSCP_ENABLE) += ecm_classifier_dscp.o
|
|
ccflags-$(ECM_CLASSIFIER_DSCP_ENABLE) += -DECM_CLASSIFIER_DSCP_ENABLE
|
|
ccflags-$(ECM_CLASSIFIER_DSCP_IGS) += -DECM_CLASSIFIER_DSCP_IGS
|
|
@@ -274,7 +294,9 @@ endif
|
|
# the Parental Controls subsystem classifier in ECM. Currently disabled until
|
|
# customers require it / if they need to integrate their Parental Controls with it.
|
|
# #############################################################################
|
|
-ECM_CLASSIFIER_PCC_ENABLE=y
|
|
+ifndef $(ECM_CLASSIFIER_PCC_ENABLE)
|
|
+ ECM_CLASSIFIER_PCC_ENABLE=y
|
|
+endif
|
|
ecm-$(ECM_CLASSIFIER_PCC_ENABLE) += ecm_classifier_pcc.o
|
|
ccflags-$(ECM_CLASSIFIER_PCC_ENABLE) += -DECM_CLASSIFIER_PCC_ENABLE
|
|
|
|
@@ -301,28 +323,36 @@ ccflags-$(ECM_NON_PORTED_SUPPORT_ENABLE)
|
|
# #############################################################################
|
|
# Define ECM_STATE_OUTPUT_ENABLE=y to support XML state output
|
|
# #############################################################################
|
|
-ECM_STATE_OUTPUT_ENABLE=y
|
|
+ifndef $(ECM_STATE_OUTPUT_ENABLE)
|
|
+ ECM_STATE_OUTPUT_ENABLE=y
|
|
+endif
|
|
ecm-$(ECM_STATE_OUTPUT_ENABLE) += ecm_state.o
|
|
ccflags-$(ECM_STATE_OUTPUT_ENABLE) += -DECM_STATE_OUTPUT_ENABLE
|
|
|
|
# #############################################################################
|
|
# Define ECM_DB_ADVANCED_STATS_ENABLE to support XML state output
|
|
# #############################################################################
|
|
-ECM_DB_ADVANCED_STATS_ENABLE=y
|
|
+ifndef $(ECM_DB_ADVANCED_STATS_ENABLE)
|
|
+ ECM_DB_ADVANCED_STATS_ENABLE=y
|
|
+endif
|
|
ccflags-$(ECM_DB_ADVANCED_STATS_ENABLE) += -DECM_DB_ADVANCED_STATS_ENABLE
|
|
|
|
# #############################################################################
|
|
# Define ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE=y in order to enable
|
|
# the database to track relationships between objects.
|
|
# #############################################################################
|
|
-ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE=y
|
|
+ifndef $(ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE)
|
|
+ ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE=y
|
|
+endif
|
|
ccflags-$(ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE) += -DECM_DB_XREF_ENABLE
|
|
|
|
# #############################################################################
|
|
# Define ECM_TRACKER_DPI_SUPPORT_ENABLE=y in order to enable support for
|
|
# deep packet inspection and tracking of data with the trackers.
|
|
# #############################################################################
|
|
-ECM_TRACKER_DPI_SUPPORT_ENABLE=y
|
|
+ifndef $(ECM_TRACKER_DPI_SUPPORT_ENABLE)
|
|
+ ECM_TRACKER_DPI_SUPPORT_ENABLE=y
|
|
+endif
|
|
ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE) += -DECM_TRACKER_DPI_SUPPORT_ENABLE
|
|
|
|
# #############################################################################
|
|
@@ -330,14 +360,18 @@ ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE
|
|
# support for the database keeping lists of connections that are assigned
|
|
# on a per TYPE of classifier basis.
|
|
# #############################################################################
|
|
-ECM_DB_CLASSIFIER_TYPE_ASSIGNMENTS_TRACK_ENABLE=y
|
|
+ifndef $(ECM_DB_CLASSIFIER_TYPE_ASSIGNMENTS_TRACK_ENABLE)
|
|
+ ECM_DB_CLASSIFIER_TYPE_ASSIGNMENTS_TRACK_ENABLE=y
|
|
+endif
|
|
ccflags-$(ECM_DB_CLASSIFIER_TYPE_ASSIGNMENTS_TRACK_ENABLE) += -DECM_DB_CTA_TRACK_ENABLE
|
|
|
|
# #############################################################################
|
|
# Define ECM_BAND_STEERING_ENABLE=y in order to enable
|
|
# band steering feature.
|
|
# #############################################################################
|
|
-ECM_BAND_STEERING_ENABLE=y
|
|
+ifndef $(ECM_BAND_STEERING_ENABLE)
|
|
+ ECM_BAND_STEERING_ENABLE=y
|
|
+endif
|
|
ccflags-$(ECM_BAND_STEERING_ENABLE) += -DECM_BAND_STEERING_ENABLE
|
|
|
|
# #############################################################################
|
|
--- a/ecm_db/ecm_db_connection.c
|
|
+++ b/ecm_db/ecm_db_connection.c
|
|
@@ -430,7 +430,9 @@ EXPORT_SYMBOL(ecm_db_connection_make_def
|
|
*/
|
|
void ecm_db_connection_data_totals_update(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets)
|
|
{
|
|
+#ifdef ECM_DB_ADVANCED_STATS_ENABLE
|
|
int32_t i;
|
|
+#endif
|
|
|
|
DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed\n", ci);
|
|
|
|
@@ -529,7 +531,9 @@ EXPORT_SYMBOL(ecm_db_connection_data_tot
|
|
*/
|
|
void ecm_db_connection_data_totals_update_dropped(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets)
|
|
{
|
|
+#ifdef ECM_DB_ADVANCED_STATS_ENABLE
|
|
int32_t i;
|
|
+#endif
|
|
|
|
DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed\n", ci);
|
|
|
|
@@ -1508,6 +1512,7 @@ void ecm_db_connection_defunct_all(void)
|
|
}
|
|
EXPORT_SYMBOL(ecm_db_connection_defunct_all);
|
|
|
|
+#ifdef ECM_INTERFACE_OVS_BRIDGE_ENABLE
|
|
/*
|
|
* ecm_db_connection_defunct_by_classifier()
|
|
* Make defunct based on masked fields
|
|
@@ -1667,6 +1672,7 @@ next_ci:
|
|
ECM_IP_ADDR_TO_OCTAL(dest_addr_mask), dest_port_mask, proto_mask, cnt);
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
/*
|
|
* ecm_db_connection_defunct_by_port()
|
|
@@ -1956,6 +1962,7 @@ struct ecm_db_node_instance *ecm_db_conn
|
|
}
|
|
EXPORT_SYMBOL(ecm_db_connection_node_get_and_ref);
|
|
|
|
+#ifdef ECM_DB_XREF_ENABLE
|
|
/*
|
|
* ecm_db_connection_mapping_get_and_ref_next()
|
|
* Return reference to next connection in the mapping chain in the specified direction.
|
|
@@ -1997,6 +2004,7 @@ struct ecm_db_connection_instance *ecm_d
|
|
return nci;
|
|
}
|
|
EXPORT_SYMBOL(ecm_db_connection_iface_get_and_ref_next);
|
|
+#endif
|
|
|
|
/*
|
|
* ecm_db_connection_mapping_get_and_ref()
|
|
--- a/ecm_db/ecm_db_node.c
|
|
+++ b/ecm_db/ecm_db_node.c
|
|
@@ -224,9 +224,11 @@ EXPORT_SYMBOL(ecm_db_node_get_and_ref_ne
|
|
*/
|
|
int ecm_db_node_deref(struct ecm_db_node_instance *ni)
|
|
{
|
|
+#ifdef ECM_DB_XREF_ENABLE
|
|
#if (DEBUG_LEVEL >= 1)
|
|
int dir;
|
|
#endif
|
|
+#endif
|
|
DEBUG_CHECK_MAGIC(ni, ECM_DB_NODE_INSTANCE_MAGIC, "%px: magic failed\n", ni);
|
|
|
|
spin_lock_bh(&ecm_db_lock);
|
|
@@ -486,9 +488,11 @@ EXPORT_SYMBOL(ecm_db_node_iface_get_and_
|
|
void ecm_db_node_add(struct ecm_db_node_instance *ni, struct ecm_db_iface_instance *ii, uint8_t *address,
|
|
ecm_db_node_final_callback_t final, void *arg)
|
|
{
|
|
+#ifdef ECM_DB_XREF_ENABLE
|
|
#if (DEBUG_LEVEL >= 1)
|
|
int dir;
|
|
#endif
|
|
+#endif
|
|
ecm_db_node_hash_t hash_index;
|
|
struct ecm_db_listener_instance *li;
|
|
|
|
--- a/ecm_interface.c
|
|
+++ b/ecm_interface.c
|
|
@@ -1343,6 +1343,7 @@ struct neighbour *ecm_interface_ipv6_nei
|
|
*/
|
|
bool ecm_interface_is_pptp(struct sk_buff *skb, const struct net_device *out)
|
|
{
|
|
+#ifdef ECM_INTERFACE_PPTP_ENABLE
|
|
struct net_device *in;
|
|
|
|
/*
|
|
@@ -1367,6 +1368,7 @@ bool ecm_interface_is_pptp(struct sk_buf
|
|
}
|
|
|
|
dev_put(in);
|
|
+#endif
|
|
return false;
|
|
}
|
|
|
|
@@ -1379,6 +1381,7 @@ bool ecm_interface_is_pptp(struct sk_buf
|
|
*/
|
|
bool ecm_interface_is_l2tp_packet_by_version(struct sk_buff *skb, const struct net_device *out, int ver)
|
|
{
|
|
+#ifdef ECM_INTERFACE_L2TPV2_PPTP_ENABLE
|
|
uint32_t flag = 0;
|
|
struct net_device *in;
|
|
|
|
@@ -1411,6 +1414,7 @@ bool ecm_interface_is_l2tp_packet_by_ver
|
|
}
|
|
|
|
dev_put(in);
|
|
+#endif
|
|
return false;
|
|
}
|
|
|
|
@@ -1423,6 +1427,7 @@ bool ecm_interface_is_l2tp_packet_by_ver
|
|
*/
|
|
bool ecm_interface_is_l2tp_pptp(struct sk_buff *skb, const struct net_device *out)
|
|
{
|
|
+#ifdef ECM_INTERFACE_L2TPV2_PPTP_ENABLE
|
|
struct net_device *in;
|
|
|
|
/*
|
|
@@ -1445,6 +1450,7 @@ bool ecm_interface_is_l2tp_pptp(struct s
|
|
}
|
|
|
|
dev_put(in);
|
|
+#endif
|
|
return false;
|
|
}
|
|
|
|
@@ -6630,6 +6636,7 @@ static void ecm_interface_regenerate_con
|
|
return;
|
|
}
|
|
|
|
+#ifdef ECM_DB_XREF_ENABLE
|
|
for (dir = 0; dir < ECM_DB_OBJ_DIR_MAX; dir++) {
|
|
/*
|
|
* Re-generate all connections associated with this interface
|
|
@@ -6645,6 +6652,7 @@ static void ecm_interface_regenerate_con
|
|
ci[dir] = cin;
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
#ifdef ECM_MULTICAST_ENABLE
|
|
/*
|
|
--- a/frontends/ecm_front_end_common.c
|
|
+++ b/frontends/ecm_front_end_common.c
|
|
@@ -106,6 +106,7 @@ bool ecm_front_end_gre_proto_is_accel_al
|
|
struct nf_conntrack_tuple *tuple,
|
|
int ip_version)
|
|
{
|
|
+#ifdef ECM_INTERFACE_GRE_ENABLE
|
|
struct net_device *dev;
|
|
struct gre_base_hdr *greh;
|
|
|
|
@@ -117,10 +118,12 @@ bool ecm_front_end_gre_proto_is_accel_al
|
|
/*
|
|
* Case 1: PPTP locally terminated
|
|
*/
|
|
+#ifdef ECM_INTERFACE_PPTP_ENABLE
|
|
if (ecm_interface_is_pptp(skb, outdev)) {
|
|
DEBUG_TRACE("%px: PPTP GRE locally terminated - allow acceleration\n", skb);
|
|
return true;
|
|
}
|
|
+#endif
|
|
|
|
/*
|
|
* Case 2: PPTP pass through
|
|
@@ -223,6 +226,10 @@ bool ecm_front_end_gre_proto_is_accel_al
|
|
*/
|
|
DEBUG_TRACE("%px: GRE IPv%d pass through - allow acceleration\n", skb, ip_version);
|
|
return true;
|
|
+#else
|
|
+ DEBUG_TRACE("%px: GRE%d feature is disabled - do not allow acceleration\n", skb, ip_version);
|
|
+ return false;
|
|
+#endif
|
|
}
|
|
|
|
#ifdef ECM_CLASSIFIER_DSCP_ENABLE
|