44c8601e06
- Fix build on Tumbleweed - use kernel_module_directory - Fix build on Linux 5.15 + Drop-ipx-support-on-Linux-5.15.patch OBS-URL: https://build.opensuse.org/request/show/934090 OBS-URL: https://build.opensuse.org/package/show/hardware/rtl8812au?expand=0&rev=37
166 lines
5.4 KiB
Diff
166 lines
5.4 KiB
Diff
From d85350854da575e1407328199062b4fd26722137 Mon Sep 17 00:00:00 2001
|
|
From: Michal Suchanek <msuchanek@suse.de>
|
|
Date: Mon, 15 Nov 2021 11:15:42 +0100
|
|
Subject: [PATCH] Drop ipx support on Linux 5.15
|
|
|
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
|
---
|
|
core/rtw_br_ext.c | 61 ++++++++++++++++++++++++++++++++++-------------
|
|
1 file changed, 45 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c
|
|
index 9a0effd..236d242 100644
|
|
--- a/core/rtw_br_ext.c
|
|
+++ b/core/rtw_br_ext.c
|
|
@@ -14,15 +14,6 @@
|
|
*****************************************************************************/
|
|
#define _RTW_BR_EXT_C_
|
|
|
|
-#ifdef __KERNEL__
|
|
- #include <linux/if_arp.h>
|
|
- #include <net/ip.h>
|
|
- #include <net/ipx.h>
|
|
- #include <linux/atalk.h>
|
|
- #include <linux/udp.h>
|
|
- #include <linux/if_pppox.h>
|
|
-#endif
|
|
-
|
|
#if 1 /* rtw_wifi_driver */
|
|
#include <drv_types.h>
|
|
#else /* rtw_wifi_driver */
|
|
@@ -38,6 +29,17 @@
|
|
#include "./8192cd_debug.h"
|
|
#endif /* rtw_wifi_driver */
|
|
|
|
+#ifdef __KERNEL__
|
|
+ #include <linux/if_arp.h>
|
|
+ #include <net/ip.h>
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
+ #include <net/ipx.h>
|
|
+#endif
|
|
+ #include <linux/atalk.h>
|
|
+ #include <linux/udp.h>
|
|
+ #include <linux/if_pppox.h>
|
|
+#endif
|
|
+
|
|
#ifdef CL_IPV6_PASS
|
|
#ifdef __KERNEL__
|
|
#include <linux/ipv6.h>
|
|
@@ -169,6 +171,7 @@ static __inline__ void __nat25_generate_ipv4_network_addr(unsigned char *network
|
|
}
|
|
|
|
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
|
|
unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
|
|
{
|
|
@@ -189,6 +192,7 @@ static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned ch
|
|
memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
|
|
memcpy(networkAddr + 5, (unsigned char *)ipxSocketAddr, 2);
|
|
}
|
|
+#endif
|
|
|
|
|
|
static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
|
|
@@ -892,39 +896,56 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|
/*---------------------------------------------------*/
|
|
/* Handle IPX and Apple Talk frame */
|
|
/*---------------------------------------------------*/
|
|
- else if ((protocol == __constant_htons(ETH_P_IPX)) ||
|
|
- (protocol == __constant_htons(ETH_P_ATALK)) ||
|
|
+ else if ((protocol == __constant_htons(ETH_P_ATALK)) ||
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
+ (protocol == __constant_htons(ETH_P_IPX)) ||
|
|
+#endif
|
|
(protocol == __constant_htons(ETH_P_AARP))) {
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
unsigned char ipx_header[2] = {0xFF, 0xFF};
|
|
struct ipxhdr *ipx = NULL;
|
|
+#endif
|
|
struct elapaarp *ea = NULL;
|
|
struct ddpehdr *ddp = NULL;
|
|
unsigned char *framePtr = skb->data + ETH_HLEN;
|
|
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
if (protocol == __constant_htons(ETH_P_IPX)) {
|
|
RTW_INFO("NAT25: Protocol=IPX (Ethernet II)\n");
|
|
ipx = (struct ipxhdr *)framePtr;
|
|
- } else { /* if(protocol <= __constant_htons(ETH_FRAME_LEN)) */
|
|
+ } else
|
|
+#endif
|
|
+ { /* if(protocol <= __constant_htons(ETH_FRAME_LEN)) */
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
if (!memcmp(ipx_header, framePtr, 2)) {
|
|
RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n");
|
|
ipx = (struct ipxhdr *)framePtr;
|
|
- } else {
|
|
+ } else
|
|
+#endif
|
|
+ {
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
unsigned char ipx_8022_type = 0xE0;
|
|
+#endif
|
|
unsigned char snap_8022_type = 0xAA;
|
|
|
|
if (*framePtr == snap_8022_type) {
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; /* IPX SNAP ID */
|
|
+#endif
|
|
unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; /* Apple Talk AARP SNAP ID */
|
|
unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; /* Apple Talk DDP SNAP ID */
|
|
|
|
framePtr += 3; /* eliminate the 802.2 header */
|
|
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
if (!memcmp(ipx_snap_id, framePtr, 5)) {
|
|
framePtr += 5; /* eliminate the SNAP header */
|
|
|
|
RTW_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n");
|
|
ipx = (struct ipxhdr *)framePtr;
|
|
- } else if (!memcmp(aarp_snap_id, framePtr, 5)) {
|
|
+ } else
|
|
+#endif
|
|
+ if (!memcmp(aarp_snap_id, framePtr, 5)) {
|
|
framePtr += 5; /* eliminate the SNAP header */
|
|
|
|
ea = (struct elapaarp *)framePtr;
|
|
@@ -937,7 +958,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|
framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
|
|
return -1;
|
|
}
|
|
- } else if (*framePtr == ipx_8022_type) {
|
|
+ } else
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
+ if (*framePtr == ipx_8022_type) {
|
|
framePtr += 3; /* eliminate the 802.2 header */
|
|
|
|
if (!memcmp(ipx_header, framePtr, 2)) {
|
|
@@ -946,9 +969,13 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|
} else
|
|
return -1;
|
|
}
|
|
+#else
|
|
+ return -1;
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
|
/* IPX */
|
|
if (ipx != NULL) {
|
|
switch (method) {
|
|
@@ -1018,7 +1045,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|
}
|
|
|
|
/* AARP */
|
|
- else if (ea != NULL) {
|
|
+ else
|
|
+#endif
|
|
+ if (ea != NULL) {
|
|
/* Sanity check fields. */
|
|
if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) {
|
|
DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n");
|
|
--
|
|
2.33.1
|
|
|