Hi,
> hi all,
>
> cuz the add_or_find_if could not open does not mean failure.
>
> izzit better this way in the follwoing function ?
>
>
>
> static int
> pcap_add_if_win32(pcap_if_t **devlist, char *name, const char *desc,
> char *errbuf)
> {
> pcap_if_t *curdev;
> npf_if_addr if_addrs[16];
> LONG if_addr_size;
> int res = 0;
> struct sockaddr_in *addr, *netmask;
>
> if_addr_size = 16;
>
> /*
> * Add an entry for this interfacwe, with no addresses.
> */
> /*
> if (add_or_find_if(&curdev, devlist, (char *)name, 0, (char *)desc,
> errbuf) == -1) {
>
> wcap30a3 -> jhn
> */
> curdev=NULL;
> if (add_or_find_if(&curdev, devlist, (char *)name, 0, (char *)desc,
> errbuf) == -1 ) {
> /*
> * Failure.
> */
> /*
> return (-1);
> wcap30a3 -> jhn
> */
> if(curdev==NULL)
> return (0); //did not add but error!! see add_or_find_if
> else
> return (-1);
> }
Yes, you are rigth, but consider that all the interfaces received by
pcap_add_if_win32() can be opened. The reason is that the list of adapters
is obtained in pcap_findalldevs() by means of the PacketGetAdapterNames()
packet.dll function. This function returns only the adapters that it's
actually able to open.
Therefore, the check that you propose should not be necessary, because the
call to pcap_open_live() inside add_or_find_if() will always succeed.
However, does this patch solve your problem?
> Izzit asso something wrong with PacketGetNetInfoEx/should use mib?
> manually checked the registry , it does not map, or enum does not
> contain desired index. ( removed the NICs and reinstalled-> Nada)
What do you mean by 'mib'?
Loris
> Aftab Jahan Subedar
> Software Engineer/Overseas Business Development Manager
> Suvastu Software
> Suvastu Tower
> 69/1 Pathapath Green Road
> Dhaka 1205
> Bangladesh
>
>
>
>
> ==================================================================
> This is the WinPcap users list. It is archived at
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe use
> mailto: [EMAIL PROTECTED]?body=unsubscribe
> ==================================================================
>
==================================================================
This is the WinPcap users list. It is archived at
http://www.mail-archive.com/[email protected]/
To unsubscribe use
mailto: [EMAIL PROTECTED]?body=unsubscribe
==================================================================