lede/package/qca/nss/qca-nss-ecm-64/patches/008-frontends-drop-use-of-static-be_liberal-and-no_windo.patch

157 lines
5.3 KiB
Diff

--- a/frontends/nss/ecm_nss_ported_ipv4.c
+++ b/frontends/nss/ecm_nss_ported_ipv4.c
@@ -125,6 +125,7 @@
static int ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_MAX] = {0};
/* Array of Number of TCP and UDP connections currently offloaded */
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
/*
* Expose what should be a static flag in the TCP connection tracker.
*/
@@ -132,6 +133,7 @@
extern int nf_ct_tcp_no_window_check;
#endif
extern int nf_ct_tcp_be_liberal;
+#endif
/*
* ecm_nss_ported_ipv4_connection_callback()
@@ -372,6 +374,10 @@
uint8_t dest_mac_xlate[ETH_ALEN];
ecm_db_direction_t ecm_dir;
ecm_front_end_acceleration_mode_t result_mode;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 12, 0)
+ struct net *net = nf_ct_net(ct);
+ struct nf_tcp_net *tn = nf_tcp_pernet(net);
+#endif
DEBUG_CHECK_MAGIC(npci, ECM_NSS_PORTED_IPV4_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci);
@@ -1236,9 +1242,17 @@
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
#ifdef ECM_OPENWRT_SUPPORT
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal || nf_ct_tcp_no_window_check
#else
+ if (tn->tcp_be_liberal || tn->tcp_no_window_check
+#endif
+#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal
+#else
+ if (tn->tcp_be_liberal
+#endif
#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
--- a/frontends/nss/ecm_nss_ported_ipv6.c
+++ b/frontends/nss/ecm_nss_ported_ipv6.c
@@ -125,6 +125,7 @@
static int ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_MAX] = {0};
/* Array of Number of TCP and UDP connections currently offloaded */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
/*
* Expose what should be a static flag in the TCP connection tracker.
*/
@@ -132,6 +133,7 @@
extern int nf_ct_tcp_no_window_check;
#endif
extern int nf_ct_tcp_be_liberal;
+#endif
/*
* ecm_nss_ported_ipv6_connection_callback()
@@ -376,6 +378,10 @@
ip_addr_t src_ip;
ip_addr_t dest_ip;
ecm_front_end_acceleration_mode_t result_mode;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 12, 0)
+ struct net *net = nf_ct_net(ct);
+ struct nf_tcp_net *tn = nf_tcp_pernet(net);
+#endif
DEBUG_CHECK_MAGIC(npci, ECM_NSS_PORTED_IPV6_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci);
@@ -1162,9 +1168,17 @@
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
#ifdef ECM_OPENWRT_SUPPORT
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal || nf_ct_tcp_no_window_check
#else
+ if (tn->tcp_be_liberal || tn->tcp_no_window_check
+#endif
+#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal
+#else
+ if (tn->tcp_be_liberal
+#endif
#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
--- a/frontends/sfe/ecm_sfe_ported_ipv4.c
+++ b/frontends/sfe/ecm_sfe_ported_ipv4.c
@@ -422,6 +422,10 @@
int32_t interface_type_counts[ECM_DB_IFACE_TYPE_COUNT];
bool rule_invalid;
ecm_db_direction_t ecm_dir;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 12, 0)
+ struct net *net = nf_ct_net(ct);
+ struct nf_tcp_net *tn = nf_tcp_pernet(net);
+#endif
ecm_front_end_acceleration_mode_t result_mode;
DEBUG_CHECK_MAGIC(npci, ECM_SFE_PORTED_IPV4_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci);
@@ -1333,9 +1337,17 @@
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
#ifdef ECM_OPENWRT_SUPPORT
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal || nf_ct_tcp_no_window_check
#else
+ if (tn->tcp_be_liberal || tn->tcp_no_window_check)
+#endif
+#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal
+#else
+ if (tn->tcp_be_liberal)
+#endif
#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
--- a/frontends/sfe/ecm_sfe_ported_ipv6.c
+++ b/frontends/sfe/ecm_sfe_ported_ipv6.c
@@ -426,6 +426,10 @@
int32_t interface_type_counts[ECM_DB_IFACE_TYPE_COUNT];
bool rule_invalid;
ip_addr_t src_ip;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
+ struct net *net = nf_ct_net(ct);
+ struct nf_tcp_net *tn = nf_tcp_pernet(net);
+#endif
ip_addr_t dest_ip;
ecm_front_end_acceleration_mode_t result_mode;
@@ -1293,9 +1297,17 @@
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
#ifdef ECM_OPENWRT_SUPPORT
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal || nf_ct_tcp_no_window_check
#else
+ if (tn->tcp_be_liberal || tn->tcp_no_window_check)
+#endif
+#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal
+#else
+ if (tn->tcp_be_liberal)
+#endif
#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {