开发者

help installing libpcap on cygwin

开发者 https://www.devze.com 2022-12-22 16:52 出处:网络
i was trying to install libpcap under cygwin on windows 7 but i had this error: $ ./configure . . . . . configure: error: see the INSTALL 开发者_开发问答for more info

i was trying to install libpcap under cygwin on windows 7 but i had this error: $ ./configure . . . . . configure: error: see the INSTALL 开发者_开发问答for more info

how can i solve this? i am using libpcap-1.0.0 which is the latest version.


http://mathieu.carbou.free.fr/wiki/index.php?title=How_to_install_Winpcap_/_Libpcap_under_Cygwin

libpcap develop pack can be found from http://www.winpcap.org/devel.htm

steps in detail as follows:

Setup Winpcap

  1. Download and unzip the pack. We will use for this example WpdPack_4_0_1.zip.

  2. Copy libraries like this:

    • WpdPack\Lib\libpacket.a to cygwin\lib\
    • WpdPack\Lib\libwpcap.a to cygwin\lib\
  3. Create a folder cygwin\usr\include\pcap\

  4. Copy all headers from WpdPack\Include to cygwin\usr\include\winpcap\

  5. Be sure you have installed Winpcap libraries and that they are in your path by typing:

    which packet.dll
    which wpcap.dll
    

For me they are in /cygdrive/c/WINDOWS/system32/

Building example using Cygwin

Open a cygwin prompt to WpdPack\Examples-pcap\basic_dump\ and execute:

basic_dump:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="basic_dump"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

basic_dump_ex:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="basic_dump_ex"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

iflist:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="iflist"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

pcap_filter (and others):

I think you can catch the pattern ;) Only replace PROG=... by the program name and it should compile.

UDPdump:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap -lwsock32"
PROG="UDPdump"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

You can test by doing a Time Synchronization with pool.ntp.org for example.


The libpcap source includes part, but not all, of the Windows support. The mechanisms used to capture network traffic are very OS-dependent (which is why libpcap exists - to hide that detail from applications).

On UN*Xes, the mechanism is part of the OS, so libpcap doesn't have to provide that mechanism.

On Windows, there's no such mechanism in the OS, so WinPcap combines a kernel-mode driver, a low-level library that talks to the driver, and a module for libpcap that uses the low-level library.

The libpcap source doesn't include the driver or the low-level library, so it's not sufficient to build a version of libpcap for Windows.

As the other answers indicate, you need WinPcap.


I know this is a late reply, but I just went through the same install issues on Windows 7.

On Windows, you should use Winpcap: http://www.winpcap.org/

0

精彩评论

暂无评论...
验证码 换一张
取 消