]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
rtl8xxx: remove ipx from realtek wlan modules
authorArne Fitzenreiter <arne_f@ipfire.org>
Thu, 4 Nov 2021 20:45:58 +0000 (21:45 +0100)
committerArne Fitzenreiter <arne_f@ipfire.org>
Thu, 4 Nov 2021 20:45:58 +0000 (21:45 +0100)
kernel 5.15 remove the ipx headers. ipx itself was removed many years ago.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
lfs/rtl8189es
lfs/rtl8812au
lfs/rtl8822bu
src/patches/rtl8189es/remove-ipx.patch [new file with mode: 0644]
src/patches/rtl8812au/remove-ipx.patch [new file with mode: 0644]
src/patches/rtl8822bu/remove-ipx.patch [new file with mode: 0644]

index e275bd516374b25cb9b3b8b583a7e68e99bdf21a..c1d39793ba1afc761831a55dea56fc221e79ad66 100644 (file)
@@ -76,6 +76,7 @@ $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/rtl8189es/remove-ipx.patch
        cd $(DIR_APP) && CONFIG_RTL8189ES=m make $(MAKETUNING) \
                -C /lib/modules/$(KVER)-$(VERSUFIX)/build/ M=$(DIR_APP)/ modules
 
index a2b9eaccbb990bc7d041c92a38e355bb927d00b9..50f35330f8de284292c23d4f01e9c44f3cab8902 100644 (file)
@@ -77,6 +77,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/rtl8812au/enable_usbmodeswitch.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/rtl8812au/remove-ipx.patch
        cd $(DIR_APP) && CONFIG_88XXAU=m make $(MAKETUNING) \
                -C /lib/modules/$(KVER)-$(VERSUFIX)/build/ M=$(DIR_APP)/ modules
 
index b7995e7e07bc99db2986efa61906a72606860a4f..9693d8abdd2b30a6a32a87bdb6651259a88eea91 100644 (file)
@@ -76,6 +76,7 @@ $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/rtl8822bu/remove-ipx.patch
        cd $(DIR_APP) && CONFIG_RTL8822BU=m make $(MAKETUNING) \
                -C /lib/modules/$(KVER)-$(VERSUFIX)/build/ M=$(DIR_APP)/ modules
 
diff --git a/src/patches/rtl8189es/remove-ipx.patch b/src/patches/rtl8189es/remove-ipx.patch
new file mode 100644 (file)
index 0000000..1340fa3
--- /dev/null
@@ -0,0 +1,319 @@
+diff -Naur rtl8189ES_linux-03ac413135a355b55b693154c44b70f86a39732e.org/core/rtw_br_ext.c rtl8189ES_linux-03ac413135a355b55b693154c44b70f86a39732e/core/rtw_br_ext.c
+--- rtl8189ES_linux-03ac413135a355b55b693154c44b70f86a39732e.org/core/rtw_br_ext.c     2021-03-02 18:42:47.000000000 +0100
++++ rtl8189ES_linux-03ac413135a355b55b693154c44b70f86a39732e/core/rtw_br_ext.c 2021-11-04 18:21:00.965922215 +0100
+@@ -22,7 +22,6 @@
+ #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>
+@@ -171,39 +170,6 @@
+ }
+-static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
+-                              unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
+-{
+-      memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
+-
+-      networkAddr[0] = NAT25_IPX;
+-      memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4);
+-      memcpy(networkAddr+5, ipxNodeAddr, 6);
+-}
+-
+-
+-static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr,
+-                              unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr)
+-{
+-      memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
+-
+-      networkAddr[0] = NAT25_IPX;
+-      memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4);
+-      memcpy(networkAddr+5, (unsigned char *)ipxSocketAddr, 2);
+-}
+-
+-
+-static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
+-                              unsigned short *network, unsigned char *node)
+-{
+-      memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
+-
+-      networkAddr[0] = NAT25_APPLE;
+-      memcpy(networkAddr+1, (unsigned char *)network, 2);
+-      networkAddr[3] = *node;
+-}
+-
+-
+ static __inline__ void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
+                               unsigned char *ac_mac, unsigned short *sid)
+ {
+@@ -929,267 +895,6 @@
+       }
+       /*---------------------------------------------------*/
+-      /*         Handle IPX and Apple Talk frame           */
+-      /*---------------------------------------------------*/
+-      else if((protocol == __constant_htons(ETH_P_IPX)) || 
+-              (protocol == __constant_htons(ETH_P_ATALK)) ||
+-              (protocol == __constant_htons(ETH_P_AARP)))
+-      {
+-              unsigned char ipx_header[2] = {0xFF, 0xFF};
+-              struct ipxhdr   *ipx = NULL;
+-              struct elapaarp *ea = NULL;
+-              struct ddpehdr  *ddp = NULL;
+-              unsigned char *framePtr = skb->data + ETH_HLEN;
+-
+-              if(protocol == __constant_htons(ETH_P_IPX))
+-              {
+-                      DBG_871X("NAT25: Protocol=IPX (Ethernet II)\n");
+-                      ipx = (struct ipxhdr *)framePtr;
+-              }
+-              else //if(protocol <= __constant_htons(ETH_FRAME_LEN))
+-              {
+-                      if(!memcmp(ipx_header, framePtr, 2))
+-                      {
+-                              DBG_871X("NAT25: Protocol=IPX (Ethernet 802.3)\n");
+-                              ipx = (struct ipxhdr *)framePtr;
+-                      }
+-                      else
+-                      {
+-                              unsigned char ipx_8022_type =  0xE0;
+-                              unsigned char snap_8022_type = 0xAA;
+-
+-                              if(*framePtr == snap_8022_type)
+-                              {
+-                                      unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37};             // IPX SNAP ID
+-                                      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(!memcmp(ipx_snap_id, framePtr, 5))
+-                                      {
+-                                              framePtr += 5;  // eliminate the SNAP header
+-
+-                                              DBG_871X("NAT25: Protocol=IPX (Ethernet SNAP)\n");
+-                                              ipx = (struct ipxhdr *)framePtr;
+-                                      }
+-                                      else if(!memcmp(aarp_snap_id, framePtr, 5))
+-                                      {
+-                                              framePtr += 5;  // eliminate the SNAP header
+-
+-                                              ea = (struct elapaarp *)framePtr;
+-                                      }
+-                                      else if(!memcmp(ddp_snap_id, framePtr, 5))
+-                                      {
+-                                              framePtr += 5;  // eliminate the SNAP header
+-
+-                                              ddp = (struct ddpehdr *)framePtr;
+-                                      }
+-                                      else
+-                                      {
+-                                              DEBUG_WARN("NAT25: Protocol=Ethernet SNAP %02x%02x%02x%02x%02x\n", framePtr[0],
+-                                                      framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
+-                                              return -1;
+-                                      }
+-                              }
+-                              else if(*framePtr == ipx_8022_type)
+-                              {
+-                                      framePtr += 3;  // eliminate the 802.2 header
+-
+-                                      if(!memcmp(ipx_header, framePtr, 2))
+-                                      {
+-                                              DBG_871X("NAT25: Protocol=IPX (Ethernet 802.2)\n");
+-                                              ipx = (struct ipxhdr *)framePtr;
+-                                      }
+-                                      else
+-                                              return -1;
+-                              }
+-                      }
+-              }
+-
+-              /*   IPX   */
+-              if(ipx != NULL)
+-              {
+-                      switch(method)
+-                      {
+-                              case NAT25_CHECK:
+-                                      if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
+-                                      {
+-                                              DBG_871X("NAT25: Check IPX skb_copy\n");
+-                                              return 0;
+-                                      }
+-                                      return -1;
+-
+-                              case NAT25_INSERT:
+-                                      {
+-                                              DBG_871X("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n",
+-                                                      ipx->ipx_dest.net,
+-                                                      ipx->ipx_dest.node[0],
+-                                                      ipx->ipx_dest.node[1],
+-                                                      ipx->ipx_dest.node[2],
+-                                                      ipx->ipx_dest.node[3],
+-                                                      ipx->ipx_dest.node[4],
+-                                                      ipx->ipx_dest.node[5],
+-                                                      ipx->ipx_dest.sock,
+-                                                      ipx->ipx_source.net,
+-                                                      ipx->ipx_source.node[0],
+-                                                      ipx->ipx_source.node[1],
+-                                                      ipx->ipx_source.node[2],
+-                                                      ipx->ipx_source.node[3],
+-                                                      ipx->ipx_source.node[4],
+-                                                      ipx->ipx_source.node[5],
+-                                                      ipx->ipx_source.sock);
+-
+-                                              if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
+-                                              {
+-                                                      DBG_871X("NAT25: Use IPX Net, and Socket as network addr\n");
+-
+-                                                      __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
+-
+-                                                      // change IPX source node addr to wlan STA address
+-                                                        memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
+-                                              }
+-                                              else
+-                                              {
+-                                                      __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_source.net, ipx->ipx_source.node);
+-                                              }
+-
+-                                              __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
+-
+-                                              __nat25_db_print(priv);
+-                                      }
+-                                      return 0;
+-
+-                              case NAT25_LOOKUP:
+-                                      {
+-                                                if(!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN))
+-                                              {
+-                                                      DBG_871X("NAT25: Lookup IPX, Modify Destination IPX Node addr\n");
+-
+-                                                      __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_dest.net, &ipx->ipx_dest.sock);
+-
+-                                                      __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-
+-                                                      // replace IPX destination node addr with Lookup destination MAC addr
+-                                                      memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
+-                                              }
+-                                              else
+-                                              {
+-                                                      __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_dest.net, ipx->ipx_dest.node);
+-
+-                                                      __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-                                              }
+-                                      }
+-                                      return 0;
+-
+-                              default:
+-                                      return -1;
+-                      }
+-              }
+-
+-              /*   AARP   */
+-              else 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");
+-                              return -1;
+-                      }
+-
+-                      switch(method)
+-                      {
+-                              case NAT25_CHECK:
+-                                      return 0;
+-
+-                              case NAT25_INSERT:
+-                                      {
+-                                              // change to AARP source mac address to wlan STA address
+-                                                memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
+-
+-                                              DBG_871X("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
+-                                                      ea->pa_src_net,
+-                                                      ea->pa_src_node,
+-                                                      ea->pa_dst_net,
+-                                                      ea->pa_dst_node);
+-
+-                                              __nat25_generate_apple_network_addr(networkAddr, &ea->pa_src_net, &ea->pa_src_node);
+-
+-                                              __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
+-
+-                                              __nat25_db_print(priv);
+-                                      }
+-                                      return 0;
+-
+-                              case NAT25_LOOKUP:
+-                                      {
+-                                              DBG_871X("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n",
+-                                                      ea->pa_src_net,
+-                                                      ea->pa_src_node,
+-                                                      ea->pa_dst_net,
+-                                                      ea->pa_dst_node);
+-
+-                                              __nat25_generate_apple_network_addr(networkAddr, &ea->pa_dst_net, &ea->pa_dst_node);
+-
+-                                              __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-
+-                                              // change to AARP destination mac address to Lookup result
+-                                              memcpy(ea->hw_dst, skb->data, ETH_ALEN);
+-                                      }
+-                                      return 0;
+-
+-                              default:
+-                                      return -1;
+-                      }
+-              }
+-
+-              /*   DDP   */
+-              else if(ddp != NULL)
+-              {
+-                      switch(method)
+-                      {
+-                              case NAT25_CHECK:
+-                                      return -1;
+-
+-                              case NAT25_INSERT:
+-                                      {
+-                                              DBG_871X("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n",
+-                                                      ddp->deh_snet,
+-                                                      ddp->deh_snode,
+-                                                      ddp->deh_dnet,
+-                                                      ddp->deh_dnode);
+-
+-                                              __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_snet, &ddp->deh_snode);
+-
+-                                              __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
+-
+-                                              __nat25_db_print(priv);
+-                                      }
+-                                      return 0;
+-
+-                              case NAT25_LOOKUP:
+-                                      {
+-                                              DBG_871X("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n",
+-                                                      ddp->deh_snet,
+-                                                      ddp->deh_snode,
+-                                                      ddp->deh_dnet,
+-                                                      ddp->deh_dnode);
+-
+-                                              __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_dnet, &ddp->deh_dnode);
+-
+-                                              __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-                                      }
+-                                      return 0;
+-
+-                              default:
+-                                      return -1;
+-                      }
+-              }
+-
+-              return -1;
+-      }
+-
+-      /*---------------------------------------------------*/
+       /*                Handle PPPoE frame                 */
+       /*---------------------------------------------------*/
+       else if((protocol == __constant_htons(ETH_P_PPP_DISC)) ||
diff --git a/src/patches/rtl8812au/remove-ipx.patch b/src/patches/rtl8812au/remove-ipx.patch
new file mode 100644 (file)
index 0000000..4bcb6d1
--- /dev/null
@@ -0,0 +1,280 @@
+diff -Naur rtl8812au-0b87ed921a8682856aed5a3e68344b0087f3c93c.org/core/rtw_br_ext.c rtl8812au-0b87ed921a8682856aed5a3e68344b0087f3c93c/core/rtw_br_ext.c
+--- rtl8812au-0b87ed921a8682856aed5a3e68344b0087f3c93c.org/core/rtw_br_ext.c   2021-05-21 22:58:44.000000000 +0200
++++ rtl8812au-0b87ed921a8682856aed5a3e68344b0087f3c93c/core/rtw_br_ext.c       2021-11-04 18:54:19.917603371 +0100
+@@ -17,7 +17,6 @@
+ #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>
+@@ -168,40 +167,6 @@
+       memcpy(networkAddr + 7, (unsigned char *)ipAddr, 4);
+ }
+-
+-static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
+-              unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
+-{
+-      memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
+-
+-      networkAddr[0] = NAT25_IPX;
+-      memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
+-      memcpy(networkAddr + 5, ipxNodeAddr, 6);
+-}
+-
+-
+-static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr,
+-              unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr)
+-{
+-      memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
+-
+-      networkAddr[0] = NAT25_IPX;
+-      memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
+-      memcpy(networkAddr + 5, (unsigned char *)ipxSocketAddr, 2);
+-}
+-
+-
+-static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
+-              unsigned short *network, unsigned char *node)
+-{
+-      memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
+-
+-      networkAddr[0] = NAT25_APPLE;
+-      memcpy(networkAddr + 1, (unsigned char *)network, 2);
+-      networkAddr[3] = *node;
+-}
+-
+-
+ static __inline__ void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
+               unsigned char *ac_mac, unsigned short *sid)
+ {
+@@ -890,227 +855,6 @@
+       }
+       /*---------------------------------------------------*/
+-      /*         Handle IPX and Apple Talk frame          */
+-      /*---------------------------------------------------*/
+-      else if ((protocol == __constant_htons(ETH_P_IPX)) ||
+-               (protocol == __constant_htons(ETH_P_ATALK)) ||
+-               (protocol == __constant_htons(ETH_P_AARP))) {
+-              unsigned char ipx_header[2] = {0xFF, 0xFF};
+-              struct ipxhdr   *ipx = NULL;
+-              struct elapaarp *ea = NULL;
+-              struct ddpehdr  *ddp = NULL;
+-              unsigned char *framePtr = skb->data + ETH_HLEN;
+-
+-              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)) */
+-                      if (!memcmp(ipx_header, framePtr, 2)) {
+-                              RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n");
+-                              ipx = (struct ipxhdr *)framePtr;
+-                      } else {
+-                              unsigned char ipx_8022_type =  0xE0;
+-                              unsigned char snap_8022_type = 0xAA;
+-
+-                              if (*framePtr == snap_8022_type) {
+-                                      unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37};             /* IPX SNAP ID */
+-                                      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 (!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)) {
+-                                              framePtr += 5;  /* eliminate the SNAP header */
+-
+-                                              ea = (struct elapaarp *)framePtr;
+-                                      } else if (!memcmp(ddp_snap_id, framePtr, 5)) {
+-                                              framePtr += 5;  /* eliminate the SNAP header */
+-
+-                                              ddp = (struct ddpehdr *)framePtr;
+-                                      } else {
+-                                              DEBUG_WARN("NAT25: Protocol=Ethernet SNAP %02x%02x%02x%02x%02x\n", framePtr[0],
+-                                                      framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
+-                                              return -1;
+-                                      }
+-                              } else if (*framePtr == ipx_8022_type) {
+-                                      framePtr += 3;  /* eliminate the 802.2 header */
+-
+-                                      if (!memcmp(ipx_header, framePtr, 2)) {
+-                                              RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.2)\n");
+-                                              ipx = (struct ipxhdr *)framePtr;
+-                                      } else
+-                                              return -1;
+-                              }
+-                      }
+-              }
+-
+-              /*   IPX  */
+-              if (ipx != NULL) {
+-                      switch (method) {
+-                      case NAT25_CHECK:
+-                              if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
+-                                      RTW_INFO("NAT25: Check IPX skb_copy\n");
+-                                      return 0;
+-                              }
+-                              return -1;
+-
+-                      case NAT25_INSERT: {
+-                              RTW_INFO("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n",
+-                                       ipx->ipx_dest.net,
+-                                       ipx->ipx_dest.node[0],
+-                                       ipx->ipx_dest.node[1],
+-                                       ipx->ipx_dest.node[2],
+-                                       ipx->ipx_dest.node[3],
+-                                       ipx->ipx_dest.node[4],
+-                                       ipx->ipx_dest.node[5],
+-                                       ipx->ipx_dest.sock,
+-                                       ipx->ipx_source.net,
+-                                       ipx->ipx_source.node[0],
+-                                       ipx->ipx_source.node[1],
+-                                       ipx->ipx_source.node[2],
+-                                       ipx->ipx_source.node[3],
+-                                       ipx->ipx_source.node[4],
+-                                       ipx->ipx_source.node[5],
+-                                       ipx->ipx_source.sock);
+-
+-                              if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
+-                                      RTW_INFO("NAT25: Use IPX Net, and Socket as network addr\n");
+-
+-                                      __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
+-
+-                                      /* change IPX source node addr to wlan STA address */
+-                                      memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
+-                              } else
+-                                      __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_source.net, ipx->ipx_source.node);
+-
+-                              __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
+-
+-                              __nat25_db_print(priv);
+-                      }
+-                      return 0;
+-
+-                      case NAT25_LOOKUP: {
+-                              if (!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN)) {
+-                                      RTW_INFO("NAT25: Lookup IPX, Modify Destination IPX Node addr\n");
+-
+-                                      __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_dest.net, &ipx->ipx_dest.sock);
+-
+-                                      __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-
+-                                      /* replace IPX destination node addr with Lookup destination MAC addr */
+-                                      memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
+-                              } else {
+-                                      __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_dest.net, ipx->ipx_dest.node);
+-
+-                                      __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-                              }
+-                      }
+-                      return 0;
+-
+-                      default:
+-                              return -1;
+-                      }
+-              }
+-
+-              /*   AARP  */
+-              else 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");
+-                              return -1;
+-                      }
+-
+-                      switch (method) {
+-                      case NAT25_CHECK:
+-                              return 0;
+-
+-                      case NAT25_INSERT: {
+-                              /* change to AARP source mac address to wlan STA address */
+-                              memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
+-
+-                              RTW_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
+-                                       ea->pa_src_net,
+-                                       ea->pa_src_node,
+-                                       ea->pa_dst_net,
+-                                       ea->pa_dst_node);
+-
+-                              __nat25_generate_apple_network_addr(networkAddr, &ea->pa_src_net, &ea->pa_src_node);
+-
+-                              __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
+-
+-                              __nat25_db_print(priv);
+-                      }
+-                      return 0;
+-
+-                      case NAT25_LOOKUP: {
+-                              RTW_INFO("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n",
+-                                       ea->pa_src_net,
+-                                       ea->pa_src_node,
+-                                       ea->pa_dst_net,
+-                                       ea->pa_dst_node);
+-
+-                              __nat25_generate_apple_network_addr(networkAddr, &ea->pa_dst_net, &ea->pa_dst_node);
+-
+-                              __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-
+-                              /* change to AARP destination mac address to Lookup result */
+-                              memcpy(ea->hw_dst, skb->data, ETH_ALEN);
+-                      }
+-                      return 0;
+-
+-                      default:
+-                              return -1;
+-                      }
+-              }
+-
+-              /*   DDP  */
+-              else if (ddp != NULL) {
+-                      switch (method) {
+-                      case NAT25_CHECK:
+-                              return -1;
+-
+-                      case NAT25_INSERT: {
+-                              RTW_INFO("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n",
+-                                       ddp->deh_snet,
+-                                       ddp->deh_snode,
+-                                       ddp->deh_dnet,
+-                                       ddp->deh_dnode);
+-
+-                              __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_snet, &ddp->deh_snode);
+-
+-                              __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
+-
+-                              __nat25_db_print(priv);
+-                      }
+-                      return 0;
+-
+-                      case NAT25_LOOKUP: {
+-                              RTW_INFO("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n",
+-                                       ddp->deh_snet,
+-                                       ddp->deh_snode,
+-                                       ddp->deh_dnet,
+-                                       ddp->deh_dnode);
+-
+-                              __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_dnet, &ddp->deh_dnode);
+-
+-                              __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-                      }
+-                      return 0;
+-
+-                      default:
+-                              return -1;
+-                      }
+-              }
+-
+-              return -1;
+-      }
+-
+-      /*---------------------------------------------------*/
+       /*                Handle PPPoE frame                */
+       /*---------------------------------------------------*/
+       else if ((protocol == __constant_htons(ETH_P_PPP_DISC)) ||
diff --git a/src/patches/rtl8822bu/remove-ipx.patch b/src/patches/rtl8822bu/remove-ipx.patch
new file mode 100644 (file)
index 0000000..d0caaed
--- /dev/null
@@ -0,0 +1,280 @@
+diff -Naur 88x2bu-fd0b735e2e30d32f4d91497242cf6af288bdd082.org/core/rtw_br_ext.c 88x2bu-fd0b735e2e30d32f4d91497242cf6af288bdd082/core/rtw_br_ext.c
+--- 88x2bu-fd0b735e2e30d32f4d91497242cf6af288bdd082.org/core/rtw_br_ext.c      2021-09-30 20:27:33.000000000 +0200
++++ 88x2bu-fd0b735e2e30d32f4d91497242cf6af288bdd082/core/rtw_br_ext.c  2021-11-04 18:57:11.853953556 +0100
+@@ -17,7 +17,6 @@
+ #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>
+@@ -168,40 +167,6 @@
+       memcpy(networkAddr + 7, (unsigned char *)ipAddr, 4);
+ }
+-
+-static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
+-              unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
+-{
+-      memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
+-
+-      networkAddr[0] = NAT25_IPX;
+-      memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
+-      memcpy(networkAddr + 5, ipxNodeAddr, 6);
+-}
+-
+-
+-static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr,
+-              unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr)
+-{
+-      memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
+-
+-      networkAddr[0] = NAT25_IPX;
+-      memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
+-      memcpy(networkAddr + 5, (unsigned char *)ipxSocketAddr, 2);
+-}
+-
+-
+-static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
+-              unsigned short *network, unsigned char *node)
+-{
+-      memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
+-
+-      networkAddr[0] = NAT25_APPLE;
+-      memcpy(networkAddr + 1, (unsigned char *)network, 2);
+-      networkAddr[3] = *node;
+-}
+-
+-
+ static __inline__ void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
+               unsigned char *ac_mac, unsigned short *sid)
+ {
+@@ -890,227 +855,6 @@
+       }
+       /*---------------------------------------------------*/
+-      /*         Handle IPX and Apple Talk frame          */
+-      /*---------------------------------------------------*/
+-      else if ((protocol == __constant_htons(ETH_P_IPX)) ||
+-               (protocol == __constant_htons(ETH_P_ATALK)) ||
+-               (protocol == __constant_htons(ETH_P_AARP))) {
+-              unsigned char ipx_header[2] = {0xFF, 0xFF};
+-              struct ipxhdr   *ipx = NULL;
+-              struct elapaarp *ea = NULL;
+-              struct ddpehdr  *ddp = NULL;
+-              unsigned char *framePtr = skb->data + ETH_HLEN;
+-
+-              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)) */
+-                      if (!memcmp(ipx_header, framePtr, 2)) {
+-                              RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n");
+-                              ipx = (struct ipxhdr *)framePtr;
+-                      } else {
+-                              unsigned char ipx_8022_type =  0xE0;
+-                              unsigned char snap_8022_type = 0xAA;
+-
+-                              if (*framePtr == snap_8022_type) {
+-                                      unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37};             /* IPX SNAP ID */
+-                                      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 (!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)) {
+-                                              framePtr += 5;  /* eliminate the SNAP header */
+-
+-                                              ea = (struct elapaarp *)framePtr;
+-                                      } else if (!memcmp(ddp_snap_id, framePtr, 5)) {
+-                                              framePtr += 5;  /* eliminate the SNAP header */
+-
+-                                              ddp = (struct ddpehdr *)framePtr;
+-                                      } else {
+-                                              DEBUG_WARN("NAT25: Protocol=Ethernet SNAP %02x%02x%02x%02x%02x\n", framePtr[0],
+-                                                      framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
+-                                              return -1;
+-                                      }
+-                              } else if (*framePtr == ipx_8022_type) {
+-                                      framePtr += 3;  /* eliminate the 802.2 header */
+-
+-                                      if (!memcmp(ipx_header, framePtr, 2)) {
+-                                              RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.2)\n");
+-                                              ipx = (struct ipxhdr *)framePtr;
+-                                      } else
+-                                              return -1;
+-                              }
+-                      }
+-              }
+-
+-              /*   IPX  */
+-              if (ipx != NULL) {
+-                      switch (method) {
+-                      case NAT25_CHECK:
+-                              if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
+-                                      RTW_INFO("NAT25: Check IPX skb_copy\n");
+-                                      return 0;
+-                              }
+-                              return -1;
+-
+-                      case NAT25_INSERT: {
+-                              RTW_INFO("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n",
+-                                       ipx->ipx_dest.net,
+-                                       ipx->ipx_dest.node[0],
+-                                       ipx->ipx_dest.node[1],
+-                                       ipx->ipx_dest.node[2],
+-                                       ipx->ipx_dest.node[3],
+-                                       ipx->ipx_dest.node[4],
+-                                       ipx->ipx_dest.node[5],
+-                                       ipx->ipx_dest.sock,
+-                                       ipx->ipx_source.net,
+-                                       ipx->ipx_source.node[0],
+-                                       ipx->ipx_source.node[1],
+-                                       ipx->ipx_source.node[2],
+-                                       ipx->ipx_source.node[3],
+-                                       ipx->ipx_source.node[4],
+-                                       ipx->ipx_source.node[5],
+-                                       ipx->ipx_source.sock);
+-
+-                              if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
+-                                      RTW_INFO("NAT25: Use IPX Net, and Socket as network addr\n");
+-
+-                                      __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
+-
+-                                      /* change IPX source node addr to wlan STA address */
+-                                      memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
+-                              } else
+-                                      __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_source.net, ipx->ipx_source.node);
+-
+-                              __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
+-
+-                              __nat25_db_print(priv);
+-                      }
+-                      return 0;
+-
+-                      case NAT25_LOOKUP: {
+-                              if (!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN)) {
+-                                      RTW_INFO("NAT25: Lookup IPX, Modify Destination IPX Node addr\n");
+-
+-                                      __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_dest.net, &ipx->ipx_dest.sock);
+-
+-                                      __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-
+-                                      /* replace IPX destination node addr with Lookup destination MAC addr */
+-                                      memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
+-                              } else {
+-                                      __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_dest.net, ipx->ipx_dest.node);
+-
+-                                      __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-                              }
+-                      }
+-                      return 0;
+-
+-                      default:
+-                              return -1;
+-                      }
+-              }
+-
+-              /*   AARP  */
+-              else 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");
+-                              return -1;
+-                      }
+-
+-                      switch (method) {
+-                      case NAT25_CHECK:
+-                              return 0;
+-
+-                      case NAT25_INSERT: {
+-                              /* change to AARP source mac address to wlan STA address */
+-                              memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
+-
+-                              RTW_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
+-                                       ea->pa_src_net,
+-                                       ea->pa_src_node,
+-                                       ea->pa_dst_net,
+-                                       ea->pa_dst_node);
+-
+-                              __nat25_generate_apple_network_addr(networkAddr, &ea->pa_src_net, &ea->pa_src_node);
+-
+-                              __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
+-
+-                              __nat25_db_print(priv);
+-                      }
+-                      return 0;
+-
+-                      case NAT25_LOOKUP: {
+-                              RTW_INFO("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n",
+-                                       ea->pa_src_net,
+-                                       ea->pa_src_node,
+-                                       ea->pa_dst_net,
+-                                       ea->pa_dst_node);
+-
+-                              __nat25_generate_apple_network_addr(networkAddr, &ea->pa_dst_net, &ea->pa_dst_node);
+-
+-                              __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-
+-                              /* change to AARP destination mac address to Lookup result */
+-                              memcpy(ea->hw_dst, skb->data, ETH_ALEN);
+-                      }
+-                      return 0;
+-
+-                      default:
+-                              return -1;
+-                      }
+-              }
+-
+-              /*   DDP  */
+-              else if (ddp != NULL) {
+-                      switch (method) {
+-                      case NAT25_CHECK:
+-                              return -1;
+-
+-                      case NAT25_INSERT: {
+-                              RTW_INFO("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n",
+-                                       ddp->deh_snet,
+-                                       ddp->deh_snode,
+-                                       ddp->deh_dnet,
+-                                       ddp->deh_dnode);
+-
+-                              __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_snet, &ddp->deh_snode);
+-
+-                              __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
+-
+-                              __nat25_db_print(priv);
+-                      }
+-                      return 0;
+-
+-                      case NAT25_LOOKUP: {
+-                              RTW_INFO("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n",
+-                                       ddp->deh_snet,
+-                                       ddp->deh_snode,
+-                                       ddp->deh_dnet,
+-                                       ddp->deh_dnode);
+-
+-                              __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_dnet, &ddp->deh_dnode);
+-
+-                              __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
+-                      }
+-                      return 0;
+-
+-                      default:
+-                              return -1;
+-                      }
+-              }
+-
+-              return -1;
+-      }
+-
+-      /*---------------------------------------------------*/
+       /*                Handle PPPoE frame                */
+       /*---------------------------------------------------*/
+       else if ((protocol == __constant_htons(ETH_P_PPP_DISC)) ||