VirtualBox

Ticket #4236: vboxnetflt.diff

File vboxnetflt.diff, 1.6 KB (added by Frank Mehnert, 15 years ago)

vboxnetflt patch

  • linux/VBoxNetFlt-linux.c

     
    2727#include <linux/netdevice.h>
    2828#include <linux/etherdevice.h>
    2929#include <linux/rtnetlink.h>
     30#include <linux/ip.h>
    3031
    3132#define LOG_GROUP LOG_GROUP_NET_FLT_DRV
    3233#include <VBox/log.h>
     
    774775    else
    775776    {
    776777        if (pBuf->ip_summed == CHECKSUM_PARTIAL && pBuf->pkt_type == PACKET_OUTGOING)
     778        {
     779#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
     780            /*
     781             * Try to work around the problem with CentOS 4.7 and 5.2 (2.6.9
     782             * and 2.6.18 kernels), they pass wrong 'h' pointer down. We take IP
     783             * header length from the header itself and reconstruct 'h' pointer
     784             * to TCP (or whatever) header.
     785             */
     786            unsigned char *tmp = pBuf->h.raw;
     787            if (pBuf->h.raw == pBuf->nh.raw && pBuf->protocol == htons(ETH_P_IP))
     788                pBuf->h.raw = pBuf->nh.raw + pBuf->nh.iph->ihl * 4;
     789#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) */
    777790            if (VBOX_SKB_CHECKSUM_HELP(pBuf))
    778791            {
    779792                LogRel(("VBoxNetFlt: Failed to compute checksum, dropping the packet.\n"));
    780793                dev_kfree_skb(pBuf);
    781794                return;
    782795            }
     796#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
     797            /* Restore the original (wrong) pointer. */
     798            pBuf->h.raw = tmp;
     799#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) */
     800        }
    783801        vboxNetFltLinuxForwardSegment(pThis, pBuf, fSrc);
    784802    }
    785803    /*

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