VirtualBox

Ticket #4236: VBoxNetFlt-linux.c.rej

File VBoxNetFlt-linux.c.rej, 2.4 KB (added by supermafete, 15 years ago)
Line 
1***************
2*** 1,4 ****
3- /* $Id: VBoxNetFlt-linux.c $ */
4 /** @file
5 * VBoxNetFlt - Network Filter Driver (Host), Linux Specific Code.
6 */
7--- 1,4 ----
8+ /* $Id: VBoxNetFlt-linux.c 48355 2009-06-08 20:21:59Z aleksey $ */
9 /** @file
10 * VBoxNetFlt - Network Filter Driver (Host), Linux Specific Code.
11 */
12***************
13*** 27,32 ****
14 #include <linux/netdevice.h>
15 #include <linux/etherdevice.h>
16 #include <linux/rtnetlink.h>
17
18 #define LOG_GROUP LOG_GROUP_NET_FLT_DRV
19 #include <VBox/log.h>
20--- 27,33 ----
21 #include <linux/netdevice.h>
22 #include <linux/etherdevice.h>
23 #include <linux/rtnetlink.h>
24+ #include <linux/ip.h>
25
26 #define LOG_GROUP LOG_GROUP_NET_FLT_DRV
27 #include <VBox/log.h>
28***************
29*** 774,785 ****
30 else
31 {
32 if (pBuf->ip_summed == CHECKSUM_PARTIAL && pBuf->pkt_type == PACKET_OUTGOING)
33 if (VBOX_SKB_CHECKSUM_HELP(pBuf))
34 {
35 LogRel(("VBoxNetFlt: Failed to compute checksum, dropping the packet.\n"));
36 dev_kfree_skb(pBuf);
37 return;
38 }
39 vboxNetFltLinuxForwardSegment(pThis, pBuf, fSrc);
40 }
41 /*
42--- 775,803 ----
43 else
44 {
45 if (pBuf->ip_summed == CHECKSUM_PARTIAL && pBuf->pkt_type == PACKET_OUTGOING)
46+ {
47+ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
48+ /*
49+ * Try to work around the problem with CentOS 4.7 and 5.2 (2.6.9
50+ * and 2.6.18 kernels), they pass wrong 'h' pointer down. We take IP
51+ * header length from the header itself and reconstruct 'h' pointer
52+ * to TCP (or whatever) header.
53+ */
54+ unsigned char *tmp = pBuf->h.raw;
55+ if (pBuf->h.raw == pBuf->nh.raw && pBuf->protocol == htons(ETH_P_IP))
56+ pBuf->h.raw = pBuf->nh.raw + pBuf->nh.iph->ihl * 4;
57+ #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) */
58 if (VBOX_SKB_CHECKSUM_HELP(pBuf))
59 {
60 LogRel(("VBoxNetFlt: Failed to compute checksum, dropping the packet.\n"));
61 dev_kfree_skb(pBuf);
62 return;
63 }
64+ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
65+ /* Restore the original (wrong) pointer. */
66+ pBuf->h.raw = tmp;
67+ #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) */
68+ }
69 vboxNetFltLinuxForwardSegment(pThis, pBuf, fSrc);
70 }
71 /*

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy