[Winpcap-users] pcap_sendpacket to local adaptor (Sending to the local machine)

Kyle Brotheridge kyle at connecttel.com.au
Mon May 24 17:44:29 PDT 2010


Thanks David,

Since you confirmed that what I'm trying to do DOES work with WinPCAP, I rewrote the entire section of code that assembles the Ethernet frame since it *must* have been something in there - Works like a charm now.

No idea how it *was* working for other hosts and not for the local machine...

Cheers,

Kyle Brotheridge

-----Original Message-----
From: winpcap-users-bounces at winpcap.org [mailto:winpcap-users-bounces at winpcap.org] On Behalf Of "Fish" (David B. Trout)
Sent: Thursday, 20 May 2010 4:52 PM
To: winpcap-users at winpcap.org
Subject: Re: [Winpcap-users] pcap_sendpacket to local adaptor (Sending to the local machine)

Mark Pizzolato wrote:

[...]
> In general, a host never sends packets on a LAN to itself.

In general.


> NICs are not designed to do that.

Misleading. NICs are designed to send whatever data you want them to send.

Whether the Ethernet packet just so happens to have the NIC's MAC in the
Ethernet packet's destination MAC field or not is immaterial. The NIC should
send whatever data you tell it to send. (That is to say the packet SHOULD
make it "onto the wire. If it doesn't then it's malfunctioning. Buy a new
NIC.)


> Pcap_sendpacket() merely asks the NIC to do what it normally does
> and send the packet out.

Correct. And whatever value is in the target MAC field of the packet being
sent shouldn't matter. The packet should get sent. Period.

<snip remainder>

FWIW, my software[1] successfully does what Kyle is currently having trouble
doing and has been successfully doing it now for many years now (since
WinPCap version 2.x on many different systems around the world each using
many different types and models (brands/manufacturers) of NICs) with
absolutely no problems whatsoever. It works fine.

The only reason I can think of as to why Kyle's efforts are working for him
is *maybe* because maybe the NIC wasn't set to promiscuous mode beforehand.
Not sure if that's a requirement for this technique to work or not, but FWIW
that's the way my software does it.[2]

Hope that helps.

-- 
"Fish" (David B. Trout) 
 fish at softdevlabs.com

[1] http://www.softdevlabs.com/ctciw32

See specifically,
http://www.softdevlabs.com/Hercules/ctci-w32-readme.html#overview

[2] Our product (Hercules, a mainframe emulator
(http://www.hercules-390.org)) runs as a virtual machine on the Windows
host, and needs to be able to exchange packets with it (or any other system
really). My CTCI-W32 software (scheduled to be renamed to CTCI-WIN)
accomplishes this by having WinPCap set the adapter into promiscuous mode
and monitoring for any packet whose destination MAC matches that of the
virtual NIC's (or has the all stations broadcast bit on). If so, the packet
is returned back to the virtual machine (i.e. Hercules) and the guest
operating system (running under Hercules) receives it. Packets that the
guest machine wants to send Hercules pass on to my code which simply does a
WinPCap sendpacket.

And as I said this all works fine and HAS been working fine for many years.


_______________________________________________
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