[Winpcap-users] Winpcap in Intanium machine

Gianluca Varenni gianluca.varenni at cacetech.com
Sun Oct 11 23:41:41 PDT 2009


----- Original Message ----- 
From: "Guy Harris" <guy at alum.mit.edu>
To: <winpcap-users at winpcap.org>
Sent: Saturday, October 10, 2009 11:37 AM
Subject: Re: [Winpcap-users] Winpcap in Intanium machine


>
> On Oct 10, 2009, at 9:11 AM, Gianluca Varenni wrote:
>
>> 2. when we access the packet contents for filtering, the header
>> fields are
>> inevitably misaligned. In that case the only solution would be using
>> macros
>> when reading the header fields from the packets to avoid
>> misalignment errors
>> on architectures like Itanium
>
> You mean macros such as
>
> #define EXTRACT_SHORT(p)\
>                 ((((u_short)(((u_char*)p)[0])) << 8) |\
>                  (((u_short)(((u_char*)p)[1])) << 0))
>
> and
>
> #define EXTRACT_LONG(p)\
>                 ((((u_int32)(((u_char*)p)[0])) << 24) |\
>                  (((u_int32)(((u_char*)p)[1])) << 16) |\
>                  (((u_int32)(((u_char*)p)[2])) << 8 ) |\
>                  (((u_int32)(((u_char*)p)[3])) << 0 ))
>
> Unless I'm missing something, or you mean something other than BPF
> filtering by "filtering", WinPcap's BPF interpreter *already* uses
> macros when reading data from packets - it's done that for ages (BPF
> dates back to about 1993; it appears they did the development on a
> SPARCstation, and SPARC processors don't do unaligned accesses).

You are totally right, Guy. I should have double-checked the BPF filtering 
code before answering. I should refrain from answering emails on saturday 
morning, still half asleep...

GV

> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users 



More information about the Winpcap-users mailing list