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