On Fri, Apr 06, 2001 at 05:13:22PM -0700, Zhigang Chen wrote: > I was wondering if libpcap functions can intercept all the incoming or > outgoing packets and send them down to NIC Libpcap supports reading packets from a network capture; it doesn't support sending raw packets, if that's what you mean by "send them down to the NIC". > or receive up to the upper layer? Libpcap doesn't support, for example, taking a packet received from a NIC and sending it back down to the networking code on your machine, so that it can be treated as if it had been received. > I need to make a program that behaves like a virtual NIC(with certain > delay and loss rate). I.e., you want to, in effect, insert into your OS's networking stack a module to artificially delay or drop packets, so that you can simulate particular delay and loss rates? Libpcap won't let you do that; unfortunately, it'd probably require, on most OSes, the assistance of OS kernel code in the networking stack other than the code that libpcap uses. > Can any other toolkit do this? FreeBSD has a mechanism called "dummynet" which, according to the dummynet man page on FreeBSD 3.4, "permits the control of traffic going through the various network interfaces, by applying bandwidth and queue size limitations, and simulating delays and losses." I don't know offhand whether any of the other BSDs have this, but they might. I would also not be at all surprised to hear that similar mechanisms exist for Linux, whether as a standard part of the Linux kernel or as an add-on package. You might want to see whether whatever OS you're using has a package like dummynet, and, if so, see whether it would do what you want to do. (I've never used dummynet, and am not very familiar with it, so I can't help you determine whether it'll do what you want.) - This is the TCPDUMP workers list. It is archived at http://www.tcpdump.org/lists/workers/index.html To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe
