Fw: Re: [Winpcap-users] Need help for capture packets on winxp box

yunshu at ph4nt0m.org yunshu at ph4nt0m.org
Thu May 25 14:14:13 GMT 2006


The problem has been solved by Vasily Borovyak,he is so kind! Now,everybody can see
what a stupid mistake I made yesterday! haha~

yunshu at ph4nt0m.org

发件人: Vasily Borovyak
发送时间: 2006-05-25 21:29:01
收件人: yunshu at ph4nt0m.org
主题: Re: [Winpcap-users] Need help for capture packets on winxp box

I made a deeper look. The problem I mention is the reason of your problem.

The size of ethernet header for IPv4 is always 14 bytes (6 bytes + 6 bytes + 2 bytes).
Your definition is 16+16+2=34 bytes long. And further in the code you're using sizeof keyword:

//get ip header
ipr = (IP_HDR *)(pchar+sizeof(ETH_HDR));

So ipr poiter points somewhere to the IP packet data but not to the header of it.
So simply change [16] to the [6].
I'm sure it will help.

I think the code you send us is not yours so you can't find the problem yourself. :)
And if you afraid if the buffer is not enough then you not understand
what the C programming language is. ;)

Best regards. Vasily Borovyak <vbor at isd.dp.ua>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20060525/935f083f/attachment.htm

More information about the Winpcap-users mailing list