VirtualBox

Changeset 11057 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Aug 1, 2008 1:45:41 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33952
Message:

intnet: Allocate a 2KB temporary buffer to deal with segmented packets during ARP and DHCP snooping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp

    r11055 r11057  
    205205    /** The SUPR0 object id. */
    206206    void                   *pvObj;
     207    /** Pointer to the temporary buffer that is used when snooping fragmented packets.
     208     * This is allocated after this structure if we're sharing the MAC address with
     209     * the host. The buffer is INTNETNETWORK_TMP_SIZE big and aligned on a 64-byte boundrary. */
     210    uint8_t                *pbTmp;
    207211    /** Network creation flags (INTNET_OPEN_FLAGS_*). */
    208212    uint32_t                fFlags;
     
    220224/** Pointer to an internal network. */
    221225typedef INTNETNETWORK *PINTNETNETWORK;
     226
     227/** The size of the buffer INTNETNETWORK::pbTmp points at. */
     228#define INTNETNETWORK_TMP_SIZE  2048
    222229
    223230
     
    33533360     * Allocate and initialize.
    33543361     */
    3355     PINTNETNETWORK pNew = (PINTNETNETWORK)RTMemAllocZ(sizeof(*pNew));
     3362    size_t cb = sizeof(INTNETNETWORK);
     3363    if (fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE)
     3364        cb += INTNETNETWORK_TMP_SIZE + 64;
     3365    PINTNETNETWORK pNew = (PINTNETNETWORK)RTMemAllocZ(cb);
    33563366    if (!pNew)
    33573367        return VERR_NO_MEMORY;
     
    33703380        Assert(strlen(pszTrunk) < sizeof(pNew->szTrunk));   /* caller's responsibility. */
    33713381        strcpy(pNew->szTrunk, pszTrunk);
     3382        if (fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE)
     3383            pNew->pbTmp = RT_ALIGN_PT(pNew + 1, 64, uint8_t *);
     3384        //else
     3385        //    pNew->pbTmp = NULL;
    33723386
    33733387        /*
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