| 1 | --- linux/VBoxNetFlt-linux.c
|
|---|
| 2 | +++ linux/VBoxNetFlt-linux.c
|
|---|
| 3 | @@ -27,6 +27,7 @@
|
|---|
| 4 | #include <linux/netdevice.h>
|
|---|
| 5 | #include <linux/etherdevice.h>
|
|---|
| 6 | #include <linux/rtnetlink.h>
|
|---|
| 7 | +#include <linux/ip.h>
|
|---|
| 8 |
|
|---|
| 9 | #define LOG_GROUP LOG_GROUP_NET_FLT_DRV
|
|---|
| 10 | #include <VBox/log.h>
|
|---|
| 11 | @@ -774,12 +775,29 @@
|
|---|
| 12 | else
|
|---|
| 13 | {
|
|---|
| 14 | if (pBuf->ip_summed == CHECKSUM_PARTIAL && pBuf->pkt_type == PACKET_OUTGOING)
|
|---|
| 15 | + {
|
|---|
| 16 | +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
|
|---|
| 17 | + /*
|
|---|
| 18 | + * Try to work around the problem with CentOS 4.7 and 5.2 (2.6.9
|
|---|
| 19 | + * and 2.6.18 kernels), they pass wrong 'h' pointer down. We take IP
|
|---|
| 20 | + * header length from the header itself and reconstruct 'h' pointer
|
|---|
| 21 | + * to TCP (or whatever) header.
|
|---|
| 22 | + */
|
|---|
| 23 | + unsigned char *tmp = pBuf->h.raw;
|
|---|
| 24 | + if (pBuf->h.raw == pBuf->nh.raw && pBuf->protocol == htons(ETH_P_IP))
|
|---|
| 25 | + pBuf->h.raw = pBuf->nh.raw + pBuf->nh.iph->ihl * 4;
|
|---|
| 26 | +#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) */
|
|---|
| 27 | if (VBOX_SKB_CHECKSUM_HELP(pBuf))
|
|---|
| 28 | {
|
|---|
| 29 | LogRel(("VBoxNetFlt: Failed to compute checksum, dropping the packet.\n"));
|
|---|
| 30 | dev_kfree_skb(pBuf);
|
|---|
| 31 | return;
|
|---|
| 32 | }
|
|---|
| 33 | +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
|
|---|
| 34 | + /* Restore the original (wrong) pointer. */
|
|---|
| 35 | + pBuf->h.raw = tmp;
|
|---|
| 36 | +#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) */
|
|---|
| 37 | + }
|
|---|
| 38 | vboxNetFltLinuxForwardSegment(pThis, pBuf, fSrc);
|
|---|
| 39 | }
|
|---|
| 40 | /*
|
|---|