<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2769" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial>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.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>The first diff adjusts one of the makefiles by adding
HAVE_REMOTE and changing the winsock library:</FONT></DIV><PRE>diff -r -d wpcapsrc_3_2_alpha1/winpcap/packetNtx/Dll/Project/GNUmakefile wpcapsrc_3_2_alpha1_mingw/winpcap/packetNtx/Dll/Project/GNUmakefile<BR>5c5<BR>< OPTFLAGS = -O -D_WINNT4<BR>---<BR>> OPTFLAGS = -O -D_WINNT4 -DHAVE_REMOTE<BR>11c11<BR>< LIBS = -lwsock32 -lversion<BR>---<BR>> LIBS = -lws2_32 -lversion</PRE>
<DIV><FONT face=Arial>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.</FONT></DIV><PRE>diff -r -d wpcapsrc_3_2_alpha1/winpcap/wpcap/libpcap/pcap-bpf.h wpcapsrc_3_2_alpha1_mingw/winpcap/wpcap/libpcap/pcap-bpf.h<BR>673a674,683<BR>> #ifdef __MINGW32__<BR>> struct bpf_stat <BR>> {<BR>> UINT bs_recv; <BR>> UINT bs_drop; <BR>> UINT ps_ifdrop;<BR>> UINT bs_capt;<BR>> };<BR>> #endif<BR>> <BR></PRE>
<DIV><FONT face=Arial>The next diff adds some things to work around a bug in the
MinW32 headers regarding getnameinfo():</FONT></DIV><PRE>diff -r -d wpcapsrc_3_2_alpha1/winpcap/wpcap/libpcap/sockutils.h wpcapsrc_3_2_alpha1_mingw/winpcap/wpcap/libpcap/sockutils.h<BR>48a49,52<BR>> /* Need windef.h for defines used in winsock2.h under MingW32 */<BR>> #ifdef __MINGW32__<BR>> #include <windef.h><BR>> #endif<BR>64a69,77<BR>> /* MingW headers include this definition, but only for Windows XP and above.<BR>> MSDN states that this function is available for most versions on Windows.<BR>> */<BR>> #if ((defined(__MINGW32__)) && (_WIN32_WINNT < 0x0501))<BR>> int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD,<BR>> char*,DWORD,int);<BR>> #endif<BR>> <BR>> <BR></PRE>
<DIV><FONT face=Arial>Next is a change to fix a warning regarding the
IN_MULTICAST define:</FONT></DIV><PRE>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<BR>33a34<BR>> #ifndef __MINGW32__<BR>34a36<BR>> #endif</PRE>
<DIV><FONT face=Arial>The next diff is the same as the previous GNUmakefile diff
with some syntax changes added:</FONT></DIV><PRE>diff -r -d wpcapsrc_3_2_alpha1/winpcap/wpcap/PRJ/GNUmakefile wpcapsrc_3_2_alpha1_mingw/winpcap/wpcap/PRJ/GNUmakefile<BR>17,18c17,18<BR>< LEX = flex -Ppcap_<BR>< YACC = bison -y -p pcap_<BR>---<BR>> LFLAGS = -Ppcap_<BR>> YFLAGS = -y -p pcap_<BR>30a31<BR>> -DHAVE_REMOTE \<BR>33c34<BR>< LIBS = -L ../../${PACKET_DIR}/DLL/Project -lPacket -lwsock32<BR>---<BR>> LIBS = -L ../../${PACKET_DIR}/DLL/Project -lPacket -lws2_32<BR>55a57,60<BR>> ../libpcap/pcap-new.o \<BR>> ../libpcap/pcap-remote.o \<BR>> ../libpcap/sockutils.o \<BR>> ../libpcap/Win32/Src/gai_strerror.o \<BR>59c64<BR>< ${CC} ${CFLAGS} ${LDFLAGS} -o wpcap.dll wpcap_no_extensions.def ${OBJS} ${LIBS}<BR>---<BR>> ${CC} ${CFLAGS} ${LDFLAGS} -o wpcap.dll wpcap.def ${OBJS} ${LIBS}<BR>65c70<BR>< rm -f ${OBJS} ../libpcap/scanner.c ../libpcap/grammar.c wpcap.a wpcap.dll<BR>---<BR>> ${RM} ${OBJS} ../libpcap/scanner.c ../libpcap/grammar.c wpcap.a wpcap.dll<BR>71,72c76,77<BR>< @rm -f ../libpcap/grammar.c ../libpcap/tokdefs.h<BR>< $(YACC) -d $<<BR>---<BR>> @${RM} ../libpcap/grammar.c ../libpcap/tokdefs.h<BR>> ${YACC} ${YFLAGS} -d $<<BR>76,77c81,82<BR>< @rm -f $@<BR>< $(LEX) -t $< >$*.c<BR>---<BR>> @${RM} $@<BR>> ${LEX} ${LFLAGS} -t $< >$*.c<BR></PRE>
<DIV><FONT face=Arial>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 <A
href="http://www.monmouth.com/~wstreett/lex-yacc/lex-yacc.html">http://www.monmouth.com/~wstreett/lex-yacc/lex-yacc.html</A>.
I got diff for Windows from <A
href="http://gnuwin32.sourceforge.net/packages/diffutils.htm">http://gnuwin32.sourceforge.net/packages/diffutils.htm</A>.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>CC=gcc</FONT></DIV>
<DIV><FONT face=Arial>RM=del</FONT></DIV>
<DIV><FONT face=Arial>YACC=bison</FONT></DIV>
<DIV><FONT face=Arial>LEX=flex</FONT></DIV>
<DIV><FONT face=Arial>BISON_SIMPLE=J:\lex-yacc\bison.simple</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=gianluca.varenni@cacetech.com
href="mailto:gianluca.varenni@cacetech.com">Gianluca Varenni</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=ouroborus@softhome.net
href="mailto:ouroborus@softhome.net">ouroborus@softhome.net</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, January 05, 2006 9:02
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Winpcap-users] Various
fixups</DIV>
<DIV><FONT face=Arial></FONT><FONT face=Arial></FONT><BR></DIV>
<DIV><FONT size=2>Hi.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Sorry for the late reply...</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>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.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Happy new year</FONT></DIV>
<DIV><FONT size=2>GV</FONT></DIV></BLOCKQUOTE></BODY></HTML>