VirtualBox

Changeset 37369 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 7, 2011 10:32:14 PM (14 years ago)
Author:
vboxsync
Message:

Network/Pcap.cpp: work around wireshark bug, which cannot always process a frame with 0 captured bytes (used to force timestamp display to approximately match VM time), and simplify code a bit.

File:
1 edited

Legend:

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

    r35346 r37369  
    55
    66/*
    7  * Copyright (C) 2006-2008 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5959    uint32_t            u32Magic;
    6060    struct pcap_hdr     pcap;
    61     struct pcaprec_hdr  rec0;
    6261};
    6362
     
    7069    PCAP_MAGIC,
    7170    { 2, 4, 0, 0, 0xffff, 1 },
    72     /* force ethereal to start at 0.000000. */
    73     { 0, 1, 0, 60 }
    74 
    75 };
    76 
     71};
     72
     73static const char s_szDummyData[] = { 0, 0, 0, 0 };
    7774
    7875/**
     
    109106int PcapStreamHdr(PRTSTREAM pStream, uint64_t StartNanoTS)
    110107{
    111     pcaprec_hdr_init Hdr = s_Hdr;
    112     pcapCalcHeader(&Hdr.rec0, StartNanoTS, 60, 0);
    113     return RTStrmWrite(pStream, &Hdr, sizeof(Hdr));
     108    int rc1 = RTStrmWrite(pStream, &s_Hdr, sizeof(s_Hdr));
     109    int rc2 = PcapStreamFrame(pStream, StartNanoTS, s_szDummyData, 60, sizeof(s_szDummyData));
     110    return RT_SUCCESS(rc1) ? rc2 : rc1;
    114111}
    115112
     
    189186int PcapFileHdr(RTFILE File, uint64_t StartNanoTS)
    190187{
    191     pcaprec_hdr_init Hdr = s_Hdr;
    192     pcapCalcHeader(&Hdr.rec0, StartNanoTS, 60, 0);
    193     return RTFileWrite(File, &Hdr, sizeof(Hdr), NULL);
     188    int rc1 = RTFileWrite(File, &s_Hdr, sizeof(s_Hdr), NULL);
     189    int rc2 = PcapFileFrame(File, StartNanoTS, s_szDummyData, 60, sizeof(s_szDummyData));
     190    return RT_SUCCESS(rc1) ? rc2 : rc1;
    194191}
    195192
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