[Winpcap-users] Various fixups

Gianluca Varenni gianluca.varenni at cacetech.com
Thu Jan 12 05:05:25 GMT 2006


Hi

I'll try to apply the patches during the weekend.

Next time, I suggest you to use "diff -U"  (unified diff), which gives a bit 
of context in the diff and helps patching the files when they have been 
slightly modified, perform a single diff for all the modifications 
(diff -Ur), and send it as an attachment...
Basically I'll need to copy and paste every single diff you sent into a text 
file, and apply it to the proper destination file.

In any case, don't worry, we all learn how to use these (nasty?) tools day 
by day :-))

Have a nice day
GV

----- Original Message ----- 
From: "deadchicken" <deadchicken at gmail.com>
To: <winpcap-users at winpcap.org>
Sent: Tuesday, January 10, 2006 8:32 PM
Subject: Re: [Winpcap-users] Various fixups


> Hopefully this will work better than the last time...
>
> -----
>
> The following is an update of my attempts to get WinPcap and it's examples 
> to
> compile under MingW. These changes were applied to a fresh copy of
> wpcapsrc_3_2_alpha1 and then diff'd against the original. Testing involved
> simply compiling the library, then compiling the packet utility I've been
> working on, then running it to see if it worked. I have little experience
> with submitting changes to community edited source code so please bear 
> with me.
>
> The first diff adjusts one of the makefiles by adding HAVE_REMOTE and 
> changing
> the winsock library:
>
> diff -r -d wpcapsrc_3_2_alpha1/winpcap/packetNtx/Dll/Project/GNUmakefile 
> wpcapsrc_3_2_alpha1_mingw/winpcap/packetNtx/Dll/Project/GNUmakefile
> 5c5
> < OPTFLAGS = -O -D_WINNT4
> ---
>> OPTFLAGS = -O -D_WINNT4 -DHAVE_REMOTE
> 11c11
> < LIBS = -lwsock32 -lversion
> ---
>> LIBS = -lws2_32 -lversion
>
>
> Then I copied the bpf_stat structure. It originates in Packet32.h.
> BPF_MAJOR_VERSION is defined which then prevents bpf_stat from being 
> defined.
> It appears that this sort of behavior has been run into before since 
> bpf_insn
> appears in two places. So I've copied bpf_stat in a similiar manner. 
> Probably
> not a good fix, but it works.
>
> diff -r -d wpcapsrc_3_2_alpha1/winpcap/wpcap/libpcap/pcap-bpf.h 
> wpcapsrc_3_2_alpha1_mingw/winpcap/wpcap/libpcap/pcap-bpf.h
> 673a674,683
>> #ifdef __MINGW32__
>> struct bpf_stat
>> {
>>  UINT bs_recv;
>>  UINT bs_drop;
>>  UINT ps_ifdrop;
>>  UINT bs_capt;
>> };
>> #endif
>>
>
>
> The next diff adds some things to work around a bug in the MinW32 headers
> regarding getnameinfo():
>
> diff -r -d wpcapsrc_3_2_alpha1/winpcap/wpcap/libpcap/sockutils.h 
> wpcapsrc_3_2_alpha1_mingw/winpcap/wpcap/libpcap/sockutils.h
> 48a49,52
>> /* Need windef.h for defines used in winsock2.h under MingW32 */
>> #ifdef __MINGW32__
>> #include <windef.h>
>> #endif
> 64a69,77
>> /* MingW headers include this definition, but only for Windows XP and 
>> above.
>>    MSDN states that this function is available for most versions on 
>> Windows.
>> */
>> #if ((defined(__MINGW32__)) && (_WIN32_WINNT < 0x0501))
>> int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD,
>>          char*,DWORD,int);
>> #endif
>>
>>
>
>
> Next is a change to fix a warning regarding the IN_MULTICAST define:
>
> diff -r -d 
> wpcapsrc_3_2_alpha1/winpcap/wpcap/libpcap/Win32/Include/ip6_misc.h 
> wpcapsrc_3_2_alpha1_mingw/winpcap/wpcap/libpcap/Win32/Include/ip6_misc.h
> 33a34
>> #ifndef __MINGW32__
> 34a36
>> #endif
>
>
> The next diff is the same as the previous GNUmakefile diff with some 
> syntax
> changes added:
>
> diff -r -d wpcapsrc_3_2_alpha1/winpcap/wpcap/PRJ/GNUmakefile 
> wpcapsrc_3_2_alpha1_mingw/winpcap/wpcap/PRJ/GNUmakefile
> 17,18c17,18
> < LEX = flex -Ppcap_
> < YACC = bison -y -p pcap_
> ---
>> LFLAGS = -Ppcap_
>> YFLAGS = -y -p pcap_
> 30a31
>>  -DHAVE_REMOTE \
> 33c34
> < LIBS = -L ../../${PACKET_DIR}/DLL/Project -lPacket -lwsock32
> ---
>> LIBS = -L ../../${PACKET_DIR}/DLL/Project -lPacket -lws2_32
> 55a57,60
>>  ../libpcap/pcap-new.o \
>>  ../libpcap/pcap-remote.o \
>>  ../libpcap/sockutils.o \
>>  ../libpcap/Win32/Src/gai_strerror.o \
> 59c64
> <  ${CC} ${CFLAGS} ${LDFLAGS} -o wpcap.dll wpcap_no_extensions.def ${OBJS} 
> ${LIBS}
> ---
>>  ${CC} ${CFLAGS} ${LDFLAGS} -o wpcap.dll wpcap.def ${OBJS} ${LIBS}
> 65c70
> <  rm -f ${OBJS} ../libpcap/scanner.c ../libpcap/grammar.c wpcap.a 
> wpcap.dll
> ---
>>  ${RM} ${OBJS} ../libpcap/scanner.c ../libpcap/grammar.c wpcap.a 
>> wpcap.dll
> 71,72c76,77
> <  @rm -f ../libpcap/grammar.c ../libpcap/tokdefs.h
> <  $(YACC) -d $<
> ---
>>  @${RM} ../libpcap/grammar.c ../libpcap/tokdefs.h
>>  ${YACC} ${YFLAGS} -d $<
> 76,77c81,82
> <  @rm -f $@<  $(LEX) -t $< >$*.c
> ---
>>  @${RM} $@>  ${LEX} ${LFLAGS} -t $< >$*.c
>
>
> These seem to be all the changes necessary to get it working on my 
> computer.
> Some further private changes not included in the above involved dealing 
> with mv
> and cp since I use the XP CLI rather than MSYS or cygwin's shell. 
> Additionally,
> I had to remember to set CC, RM, YACC, LEX, and BISON_SIMPLE in my 
> environment
> variables, something that those familiar with makefiles probably already 
> know to
> do. I got flex and bison for Windows from:
>
> http://www.monmouth.com/~wstreett/lex-yacc/lex-yacc.html
>
> I got diff for Windows from:
>
> http://gnuwin32.sourceforge.net/packages/diffutils.htm
>
> My environment variables were:
>
> CC=gcc
> RM=del
> YACC=bison
> LEX=flex
> BISON_SIMPLE=J:\lex-yacc\bison.simple
>
>
> ----- Original Message -----
> From: Gianluca Varenni
> To: ouroborus at softhome.net
> Sent: Thursday, January 05, 2006 9:02 AM
> Subject: Re: [Winpcap-users] Various fixups
>
>
> Hi.
>
> Sorry for the late reply...
>
> Do you have any update to these patches? I can probably find some time in 
> the
> next week or so to try applying these patches to main source tree, it we 
> can
> succeed in making it compile under Cygwin/MingW without breaking any 
> license.
>
> Happy new year
> 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