----- Original Message ----- From: "Gianluca Varenni" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 21, 2004 9:10 AM Subject: Re: [WinPcap-users] does winpcap work with adapter with multiple IP addresses?
> Hi. > > Why don't you use pcap_findalldevs() or pcap_findalldevs_ex()? > > It returns a list of adapters (i.e. pcap_if structures), each one containing > a list of the IPv4 and IPv6 addresses associated to each adapter. > > In particular, there's a example in the developer's pack (iflist) showing > how to obtain the list of addresses for each adapter. The same example is > present in the tutorial part of the winpcap documentation, available online > at oops... it's at http://winpcap.polito.it/docs/docs31beta/html/group__wpcap__tut2.html > > > Have a nice day > GV > > > > ----- Original Message ----- > From: "Gisle Vanem" <[EMAIL PROTECTED]> > To: "WinDump" <[EMAIL PROTECTED]> > Sent: Tuesday, April 20, 2004 2:38 PM > Subject: Re: [WinPcap-users] does winpcap work with adapter with multiple IP > addresses? > > > > (please don't start a new thread by replying to a previous unrelated > > posting. It messes up threaded email clients and the web-mail archive). > > > > Jinhai Yang said: > > > > > I'm looking at set up proper filter rules for an > > > adapter with two IP addresses. My question is: Does > > > winpcap work with adapter with multiple IP addresses? > > > > > > I looked at the code, seems to me pcap_lookupnet() and > > > pcap_compile() both assume one IP address per adapter. > > > > Yes, pcap_lookupnet() returns only the 1st address. It says so > > plainly in the comment in inet.c: > > We need only the first IPv4 address, so we must scan the array returned > > by PacketGetNetInfo() in order to skip non IPv4 (i.e. IPv6 addresses). > > > > You can probably circumvent this by calling PacketGetNetInfoEx() and > > extract the correct address before calling pcap_compile(). > > > > But are you sure Windows doesn't create two devices in this case? > > (one for each address. The 2nd being some pseudo device one can use > > to route through to the 1st device. I know it does that for Terredo/IPv6 > > tunneling). > > > > PS. What would be the proper description of such a box? I thought > > "multihomed" means a box with >1 adapter and 1 address each. Is > > this a multihomed box too? > > > > --gv > > > > > > > > ================================================================== > > This is the WinPcap users list. It is archived at > > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > > > To unsubscribe use > > mailto: [EMAIL PROTECTED] > > ================================================================== > > > ================================================================== This is the WinPcap users list. It is archived at http://www.mail-archive.com/[EMAIL PROTECTED]/ To unsubscribe use mailto: [EMAIL PROTECTED] ==================================================================
