VirtualBox

Ignore:
Timestamp:
Nov 24, 2008 9:30:16 PM (16 years ago)
Author:
vboxsync
Message:

Linux hostif: Added checksum computation for non-gso packets with partial checksum.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c

    r14508 r14547  
    5959#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
    6060# define VBOX_SKB_IS_GSO(skb) skb_is_gso(skb)
     61                                        /* No features, very dumb device */
    6162# define VBOX_SKB_GSO_SEGMENT(skb) skb_gso_segment(skb, 0)
    6263#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) */
     
    494495static void vboxNetFltLinuxForwardToIntNet(PVBOXNETFLTINS pThis, struct sk_buff *pBuf)
    495496{
    496     struct sk_buff *pNext, *pSegment = NULL;
    497497    uint32_t fSrc = pBuf->pkt_type == PACKET_OUTGOING ? INTNETTRUNKDIR_HOST : INTNETTRUNKDIR_WIRE;
    498498
     
    511511#endif
    512512
    513     //Log2(("vboxNetFltLinuxForwardToIntNet: cb=%u gso_size=%u gso_segs=%u gso_type=%u\n",
    514     //      pBuf->len, skb_shinfo(pBuf)->gso_size, skb_shinfo(pBuf)->gso_segs, skb_shinfo(pBuf)->gso_type));
    515 
    516513    if (VBOX_SKB_IS_GSO(pBuf))
    517514    {
    518515        /* Need to segment the packet */
    519         struct sk_buff *pSegments = VBOX_SKB_GSO_SEGMENT(pBuf); /* No features, very dumb device */
    520         pBuf->next = pSegments;
     516        struct sk_buff *pNext, *pSegment;
     517        Log2(("vboxNetFltLinuxForwardToIntNet: cb=%u gso_size=%u gso_segs=%u gso_type=%u\n",
     518              pBuf->len, skb_shinfo(pBuf)->gso_size, skb_shinfo(pBuf)->gso_segs, skb_shinfo(pBuf)->gso_type));
     519
     520        for (pSegment = VBOX_SKB_GSO_SEGMENT(pBuf); pSegment; pSegment = pNext)
     521        {
     522            pNext = pSegment->next;
     523            pSegment->next = 0;
     524            vboxNetFltLinuxForwardSegment(pThis, pSegment, fSrc);
     525        }
     526        dev_kfree_skb(pBuf);
     527    }
     528    else
     529    {
     530        if (pBuf->ip_summed == CHECKSUM_PARTIAL)
     531            if (skb_checksum_help(pBuf))
     532            {
     533                LogRel(("VBoxNetFlt: Failed to compute checksum, dropping the packet.\n"));
     534                dev_kfree_skb(pBuf);
     535                return;
     536            }
     537        vboxNetFltLinuxForwardSegment(pThis, pBuf, fSrc);
    521538    }
    522539    /*
    523540     * Create a (scatter/)gather list for the sk_buff and feed it to the internal network.
    524541     */
    525     for (pSegment = pBuf; pSegment; pSegment = pNext)
    526     {
    527         pNext = pSegment->next;
    528         pSegment->next = 0;
    529         vboxNetFltLinuxForwardSegment(pThis, pSegment, fSrc);
    530     }
    531542}
    532543
Note: See TracChangeset for help on using the changeset viewer.

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