]> git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blob - src/patches/rtl8822bu/remove-ipx.patch
rtl8189fs: update to 476020109b3841421af289a7b78c7a25b0c45fac
[people/mfischer/ipfire-2.x.git] / src / patches / rtl8822bu / remove-ipx.patch
1 diff -Naur 88x2bu-fd0b735e2e30d32f4d91497242cf6af288bdd082.org/core/rtw_br_ext.c 88x2bu-fd0b735e2e30d32f4d91497242cf6af288bdd082/core/rtw_br_ext.c
2 --- 88x2bu-fd0b735e2e30d32f4d91497242cf6af288bdd082.org/core/rtw_br_ext.c 2021-09-30 20:27:33.000000000 +0200
3 +++ 88x2bu-fd0b735e2e30d32f4d91497242cf6af288bdd082/core/rtw_br_ext.c 2021-11-04 18:57:11.853953556 +0100
4 @@ -17,7 +17,6 @@
5 #ifdef __KERNEL__
6 #include <linux/if_arp.h>
7 #include <net/ip.h>
8 - #include <net/ipx.h>
9 #include <linux/atalk.h>
10 #include <linux/udp.h>
11 #include <linux/if_pppox.h>
12 @@ -168,40 +167,6 @@
13 memcpy(networkAddr + 7, (unsigned char *)ipAddr, 4);
14 }
15
16 -
17 -static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
18 - unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
19 -{
20 - memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
21 -
22 - networkAddr[0] = NAT25_IPX;
23 - memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
24 - memcpy(networkAddr + 5, ipxNodeAddr, 6);
25 -}
26 -
27 -
28 -static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr,
29 - unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr)
30 -{
31 - memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
32 -
33 - networkAddr[0] = NAT25_IPX;
34 - memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
35 - memcpy(networkAddr + 5, (unsigned char *)ipxSocketAddr, 2);
36 -}
37 -
38 -
39 -static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
40 - unsigned short *network, unsigned char *node)
41 -{
42 - memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
43 -
44 - networkAddr[0] = NAT25_APPLE;
45 - memcpy(networkAddr + 1, (unsigned char *)network, 2);
46 - networkAddr[3] = *node;
47 -}
48 -
49 -
50 static __inline__ void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
51 unsigned char *ac_mac, unsigned short *sid)
52 {
53 @@ -890,227 +855,6 @@
54 }
55
56 /*---------------------------------------------------*/
57 - /* Handle IPX and Apple Talk frame */
58 - /*---------------------------------------------------*/
59 - else if ((protocol == __constant_htons(ETH_P_IPX)) ||
60 - (protocol == __constant_htons(ETH_P_ATALK)) ||
61 - (protocol == __constant_htons(ETH_P_AARP))) {
62 - unsigned char ipx_header[2] = {0xFF, 0xFF};
63 - struct ipxhdr *ipx = NULL;
64 - struct elapaarp *ea = NULL;
65 - struct ddpehdr *ddp = NULL;
66 - unsigned char *framePtr = skb->data + ETH_HLEN;
67 -
68 - if (protocol == __constant_htons(ETH_P_IPX)) {
69 - RTW_INFO("NAT25: Protocol=IPX (Ethernet II)\n");
70 - ipx = (struct ipxhdr *)framePtr;
71 - } else { /* if(protocol <= __constant_htons(ETH_FRAME_LEN)) */
72 - if (!memcmp(ipx_header, framePtr, 2)) {
73 - RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n");
74 - ipx = (struct ipxhdr *)framePtr;
75 - } else {
76 - unsigned char ipx_8022_type = 0xE0;
77 - unsigned char snap_8022_type = 0xAA;
78 -
79 - if (*framePtr == snap_8022_type) {
80 - unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; /* IPX SNAP ID */
81 - unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; /* Apple Talk AARP SNAP ID */
82 - unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; /* Apple Talk DDP SNAP ID */
83 -
84 - framePtr += 3; /* eliminate the 802.2 header */
85 -
86 - if (!memcmp(ipx_snap_id, framePtr, 5)) {
87 - framePtr += 5; /* eliminate the SNAP header */
88 -
89 - RTW_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n");
90 - ipx = (struct ipxhdr *)framePtr;
91 - } else if (!memcmp(aarp_snap_id, framePtr, 5)) {
92 - framePtr += 5; /* eliminate the SNAP header */
93 -
94 - ea = (struct elapaarp *)framePtr;
95 - } else if (!memcmp(ddp_snap_id, framePtr, 5)) {
96 - framePtr += 5; /* eliminate the SNAP header */
97 -
98 - ddp = (struct ddpehdr *)framePtr;
99 - } else {
100 - DEBUG_WARN("NAT25: Protocol=Ethernet SNAP %02x%02x%02x%02x%02x\n", framePtr[0],
101 - framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
102 - return -1;
103 - }
104 - } else if (*framePtr == ipx_8022_type) {
105 - framePtr += 3; /* eliminate the 802.2 header */
106 -
107 - if (!memcmp(ipx_header, framePtr, 2)) {
108 - RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.2)\n");
109 - ipx = (struct ipxhdr *)framePtr;
110 - } else
111 - return -1;
112 - }
113 - }
114 - }
115 -
116 - /* IPX */
117 - if (ipx != NULL) {
118 - switch (method) {
119 - case NAT25_CHECK:
120 - if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
121 - RTW_INFO("NAT25: Check IPX skb_copy\n");
122 - return 0;
123 - }
124 - return -1;
125 -
126 - case NAT25_INSERT: {
127 - RTW_INFO("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n",
128 - ipx->ipx_dest.net,
129 - ipx->ipx_dest.node[0],
130 - ipx->ipx_dest.node[1],
131 - ipx->ipx_dest.node[2],
132 - ipx->ipx_dest.node[3],
133 - ipx->ipx_dest.node[4],
134 - ipx->ipx_dest.node[5],
135 - ipx->ipx_dest.sock,
136 - ipx->ipx_source.net,
137 - ipx->ipx_source.node[0],
138 - ipx->ipx_source.node[1],
139 - ipx->ipx_source.node[2],
140 - ipx->ipx_source.node[3],
141 - ipx->ipx_source.node[4],
142 - ipx->ipx_source.node[5],
143 - ipx->ipx_source.sock);
144 -
145 - if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
146 - RTW_INFO("NAT25: Use IPX Net, and Socket as network addr\n");
147 -
148 - __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
149 -
150 - /* change IPX source node addr to wlan STA address */
151 - memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
152 - } else
153 - __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_source.net, ipx->ipx_source.node);
154 -
155 - __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
156 -
157 - __nat25_db_print(priv);
158 - }
159 - return 0;
160 -
161 - case NAT25_LOOKUP: {
162 - if (!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN)) {
163 - RTW_INFO("NAT25: Lookup IPX, Modify Destination IPX Node addr\n");
164 -
165 - __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_dest.net, &ipx->ipx_dest.sock);
166 -
167 - __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
168 -
169 - /* replace IPX destination node addr with Lookup destination MAC addr */
170 - memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
171 - } else {
172 - __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_dest.net, ipx->ipx_dest.node);
173 -
174 - __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
175 - }
176 - }
177 - return 0;
178 -
179 - default:
180 - return -1;
181 - }
182 - }
183 -
184 - /* AARP */
185 - else if (ea != NULL) {
186 - /* Sanity check fields. */
187 - if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) {
188 - DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n");
189 - return -1;
190 - }
191 -
192 - switch (method) {
193 - case NAT25_CHECK:
194 - return 0;
195 -
196 - case NAT25_INSERT: {
197 - /* change to AARP source mac address to wlan STA address */
198 - memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
199 -
200 - RTW_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
201 - ea->pa_src_net,
202 - ea->pa_src_node,
203 - ea->pa_dst_net,
204 - ea->pa_dst_node);
205 -
206 - __nat25_generate_apple_network_addr(networkAddr, &ea->pa_src_net, &ea->pa_src_node);
207 -
208 - __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
209 -
210 - __nat25_db_print(priv);
211 - }
212 - return 0;
213 -
214 - case NAT25_LOOKUP: {
215 - RTW_INFO("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n",
216 - ea->pa_src_net,
217 - ea->pa_src_node,
218 - ea->pa_dst_net,
219 - ea->pa_dst_node);
220 -
221 - __nat25_generate_apple_network_addr(networkAddr, &ea->pa_dst_net, &ea->pa_dst_node);
222 -
223 - __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
224 -
225 - /* change to AARP destination mac address to Lookup result */
226 - memcpy(ea->hw_dst, skb->data, ETH_ALEN);
227 - }
228 - return 0;
229 -
230 - default:
231 - return -1;
232 - }
233 - }
234 -
235 - /* DDP */
236 - else if (ddp != NULL) {
237 - switch (method) {
238 - case NAT25_CHECK:
239 - return -1;
240 -
241 - case NAT25_INSERT: {
242 - RTW_INFO("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n",
243 - ddp->deh_snet,
244 - ddp->deh_snode,
245 - ddp->deh_dnet,
246 - ddp->deh_dnode);
247 -
248 - __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_snet, &ddp->deh_snode);
249 -
250 - __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
251 -
252 - __nat25_db_print(priv);
253 - }
254 - return 0;
255 -
256 - case NAT25_LOOKUP: {
257 - RTW_INFO("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n",
258 - ddp->deh_snet,
259 - ddp->deh_snode,
260 - ddp->deh_dnet,
261 - ddp->deh_dnode);
262 -
263 - __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_dnet, &ddp->deh_dnode);
264 -
265 - __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
266 - }
267 - return 0;
268 -
269 - default:
270 - return -1;
271 - }
272 - }
273 -
274 - return -1;
275 - }
276 -
277 - /*---------------------------------------------------*/
278 /* Handle PPPoE frame */
279 /*---------------------------------------------------*/
280 else if ((protocol == __constant_htons(ETH_P_PPP_DISC)) ||