<!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.2722" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I have no idea why your application does not "respond" to
directed packets. Have you tried using Windump or Ethereal and see if you
actually receive those directed packets?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>Regarding the MAC issue in V3.1, there is no
guarantee</FONT> <FONT size=2>that a MAC address is associated with a
device (this is particularly true for the GenericDialupAdapter, that was added
in WinPcap v3.1), that's the reason for the NULL pointer.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Hope it helps</FONT></DIV>
<DIV><FONT size=2>GV</FONT></DIV>
<BLOCKQUOTE
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=ewan.macpherson@frontiernet.net
href="mailto:ewan.macpherson@frontiernet.net">Ewan MacPherson</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org
href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, August 28, 2005 7:25
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Winpcap-users] Missing directed
packets in VC++6</DIV>
<DIV><FONT size=2></FONT><FONT size=2></FONT><BR></DIV>
<DIV><FONT face=Arial size=2>I am using VC++ 6.0 to create an app. which uses
Winpcap. If I use the app on the computer which contains the VC++ IDE etc. the
app works fine. I have win2000.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>If, however, I install the app. on
another (almost identical) computer on which I installed winpcap, the app.
only responds to broadcast packets and not those directed to its MAC address.
Yes, I changed the MAC address when installing in the new PC.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>All this is using Winpcap v3.0. When I uninstall
v3.0 and install v3.1 a different strange thing occurs. In both the PC
which "works" and the one which "doesn't work" I get a NULL pointer in
"mac_ptr = get_mac_addr(adap);".</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>When I go back to v3.0 I get the previous
condition.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you for any help you can give.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Here is the relevant code:-</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>/////////////////////////////////////////////////////////////////////////////<BR>//
pfx is defined in the class header file</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV><FONT face=Arial size=2>
<DIV>pcap_if_t
*d;<BR>char
mac[6];<BR>unsigned char
*packet;
// this is the
pointer<BR>char
apacket[MAXBYTES];
// this is the actual
packet<BR>int
NewCardPending;<BR>char
errbuf[PCAP_ERRBUF_SIZE+1];<BR>char
MACaddr[6];<BR><BR>int
pfx/**/MainProgram(void)
// from the start button to here<BR>{ <BR>
pcap_if_t *alldevs;<BR>
char
*mac_ptr;
// Pointer to returned MAC address<BR>
char mac2[6];<BR>
ADAPTER *adap;<BR>
BOOL bummer;<BR>
FILE *fp;<BR>
char check[128];</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> /* Ethernet Initialization */<BR> fp = fopen("MACADDR.INI",
"r");</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> if (fp == NULL)<BR> {<BR>
m_Message.SetWindowText(CString("No MAC File"));<BR> return
-1;<BR> }</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> fscanf(fp, "%s %x %x %x %x %x
%x",<BR>
check,<BR>
&mac[0],
// mac address of
adapter<BR>
&mac[1],
// get from
file<BR>
&mac[2],<BR>
&mac[3],<BR>
&mac[4],<BR>
&mac[5]);</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> if ((check[0] != '*') || (check[1] != 'M') || (check[4] !=
'*'))<BR> {<BR> m_Message.SetWindowText(CString("Bad
MAC File"));<BR> return -1;<BR> }</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> fclose(fp);</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> /* Retrieve the ethernet interfaces list */<BR> if
(pcap_findalldevs(&alldevs, errbuf) == -1)<BR>
{<BR> m_Message.SetWindowText(CString("Cannot find Ethernet
Adapters"));<BR>
pcap_freealldevs(alldevs);<BR> return -1;<BR> }</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> /* Scan the retrieved list */<BR> for(d = alldevs; d != 0; d
= d->next)<BR> {<BR> adap =
PacketOpenAdapter(d->name); // Initialize the
pointer</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> mac_ptr = get_mac_addr(adap);</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> if (mac_ptr == NULL)<BR>
{<BR> m_Message.SetWindowText(CString("NULL Mac
pointer"));<BR>
pcap_freealldevs(alldevs);<BR> return
-1;<BR> }</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> memcpy(mac2, mac_ptr, 6);</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> bummer = false;</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> for (int i = 0; i < 6;
i++)<BR> if (mac[i] !=
mac2[i])<BR> bummer = true;</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> if (bummer == false)<BR>
{<BR> m_Message.SetWindowText(CString("Found
Ethernet
Adapter"));<BR> <BR>
pfx/**/DoMainLoop(); //
never return<BR> } <BR>
}
// try next device</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> pcap_freealldevs(alldevs);<BR>
m_Message.SetWindowText(CString("No Matching Ethernet Adapter"));</DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV> return 1;<BR>}<BR></FONT></DIV>
<P></P><FONT face=Arial size=2></FONT>
<HR>
<P></P>_______________________________________________<BR>Winpcap-users
mailing
list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE></BODY></HTML>