<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Sent again, as I don't receive the copy from the list.<br> <BR><div><hr id="stopSpelling">From: carpe7@hotmail.com<br>To: winpcap-users@winpcap.org<br>Subject: FW: Service crash after update to WinPcap networking<br>Date: Fri, 28 Mar 2014 12:14:08 +0000<br><br>

<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
<div dir="ltr">The other server has just crashed. So the problem is not restricted to a single machine.<br>We are thinking about updating HP NIC drivers and firmware (dated January 2011), hoping that an outdated driver/firmware could make WinPcap more prone to participate in these crashes.<br> <br>There is another strange behaviour: we have applied a safety mechanism to detect malformed packets; it compares the len property of the pktHeader returned by WinPcap to the datagramSize derived from the IP datagram header. If they don't match, a log message is written, and the packet is discarded.<br> <br>                    Public Const EthernetHeaderSize = 14<br>                    Public Const BasicIPHeaderSize = 20<br>                    Private _MaxDatagramSize As Integer = 65535<br>                    Private _MaxEthernetPacketSize As Integer = EthernetHeaderSize + Me._MaxDatagramSize<br>                    ...<br>                    Dim errBuf As New StringBuilder(WinPcap.Constants.PCAP_ERRBUF_SIZE)<br>                    Dim session = WinPcap.Driver.pcap_open(Me._DeviceName, Me._MaxEthernetPacketSize, WinPcap.Constants.PCAP_OPENFLAG_MAX_RESPONSIVENESS + WinPcap.Constants.PCAP_OPENFLAG_NOCAPTURE_LOCAL, 1, IntPtr.Zero, errBuf)<br>                    ...<br>                    While Not cancellationTokenSource.IsCancellationRequested<br>                        Dim pktHeader As IntPtr = IntPtr.Zero<br>                        Dim pktData As IntPtr = IntPtr.Zero<br>                        Select Case WinPcap.Driver.pcap_next_ex(session, pktHeader, pktData)<br>                            Case 0<br>                                Continue While<br>                            Case Is < 0<br>                                Throw New Exception(WinPcap.Driver.pcap_geterr(session))<br>                        End Select<br>                        Dim header = DirectCast(Marshal.PtrToStructure(pktHeader, GetType(WinPcap.pcap_pkthdr)), WinPcap.pcap_pkthdr)<br>                        If header.len > EthernetHeaderSize + BasicIPHeaderSize Then 'Ethernet header + IPv4 header (without options)<br>                            Dim datagramSize As UShort = Marshal.ReadByte(pktData, EthernetHeaderSize + 2)<br>                            datagramSize <<= 8<br>                            datagramSize = datagramSize Or Marshal.ReadByte(pktData, EthernetHeaderSize + 3)<br>                            If header.len >= EthernetHeaderSize + datagramSize AndAlso datagramSize <= Me._MaxDatagramSize Then<br>    'Process the packet<br>                                ...<br><strong>                            Else<br>                                Logging.Write(TraceEventType.Verbose, "Discarded packet with datagramSize {0} and header.len {1}", datagramSize, header.len)<br>                            End If<br></strong>                        End If<br>                    End While<br> <br>Well, it is happening, very significantly I would say.<br> <br>My questions are:<br>-- Is it common that packets are this malformed?<br>-- Is my understanding right that in PCAP_OPENFLAG_MAX_RESPONSIVENESS mode WinPcap delivers complete datagrams to the application (if the internal buffer is big enough)? I'm not precluding IP fragmentation, rather I wonder whether individual datagrams (be they fragments or not) are delivered as indisivible units to the application. Otherwise, the behaviour we are experiencing could be the result of WinPcap delivering a portion of a datagram, not the whole datagram; but it would be a burden for the application to aggregate the portions.<br> <br>Thank you very much.<br> <br>J.M.<br> <br><div><hr id="ecxstopSpelling">From: carpe7@hotmail.com<br>To: winpcap-users@winpcap.org<br>Subject: Service crash after update to WinPcap networking<br>Date: Fri, 28 Mar 2014 10:07:37 +0000<br><br>

<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}


--></style>
<div dir="ltr">Hi,<br> <br>We have updated the raw socket networking subsystem of a Windows service to WinPcap, with the following architecture:<br>-- One thread continuously captures on its own pcap_t calling pcap_next_ex.<br>-- Several threads send packets concurrently over the same interface, but each one with it own private pcap_t obtained from pcap_open. These threads call pcap_sendpacket.<br> <br>Since the update, the service crashes intermittently, although only one of the two servers in a redundant cluster exhibit the problem.<br>We are logging the errors produced by WinPcap. For that, after pcap_sendpacket returning a negative result we call pcap_geterr.<br> <br>Just before the crash, the service logs (pcap_geterr result):<br> <br><em>send error: PacketSendPacket failed</em><br><em></em> <br>In EventViewer, this is the detail of the crash:<br> <br><em>Faulting application name: ...<br>Faulting module name: ntdll.dll, version: 6.1.7601.17725, time stamp: 0x4ec4aa8e<br>Exception code: 0xc0000374<br>Fault offset: 0x00000000000c40f2<br>Faulting process id: 0x1d64<br>Faulting application start time: 0x01cf4a53bf7cfe86<br>Faulting application path: ...<br>Faulting module path: C:\Windows\SYSTEM32\ntdll.dll<br>Report Id: 0e886882-b656-11e3-b6bb-e4115be757a8</em><br><em></em> <br>The OS is Windows Server 2008 R2 64 bits.<br>The WinPcap version is 4.1.3.<br><em></em> <br>The question is: has someone observed this problem?<br> <br>Thank you very much.<br> <br>Regards,<br>J.M.<br>                                         </div></div>                                        </div></div>                                        </div></body>
</html>