[Winpcap-users] How can I get the IP address of gatewaythroughWinPcap

Gianluca Varenni gianluca.varenni at cacetech.com
Fri Jul 20 16:43:32 GMT 2007


----- Original Message ----- 
From: "he tao" <hetaozju at gmail.com>
To: <winpcap-users at winpcap.org>
Sent: Thursday, July 19, 2007 9:29 PM
Subject: Re: [Winpcap-users] How can I get the IP address of 
gatewaythroughWinPcap


> Agreed. Also the ip of gateway can be read from registry
> [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{64B3C6C6-A3C4-4293-AC98-5BF7C17B467D}]\DefaultGateway
> (DHCPDefaultGateway if dhcp enabled)
> {64B3C6C6-A3C4-4293-AC98-5BF7C17B467D} can be get by parsing the
> device name of pcap_t. I was doing like this because I don't want to
> download win platform sdk:-)
>

And you are basically using an undocumented method to retrieve the 
gateway... there's no guarantee that registry key won't change over time...
(I know, WinPcap uses a similar technique in some cases, and it's something 
that I'd like to remove in the future, if I have time...)

Just my two cents
GV


> On 7/20/07, Gianluca Varenni <gianluca.varenni at cacetech.com> wrote:
>>
>> Tony,
>>
>> there's no API in WinPcap to obtain the gateway of an interface. You
>> probably need to use the IP helper API to obtain such information. In
>> particular, I think you need to use the Win32 function GetAdaptersInfo.
>>
>> Hope it helps
>> GV
>>
>>
>> ----- Original Message -----
>>
>> From: Tony Yang
>> To: winpcap-users at winpcap.org
>> Sent: Monday, July 16, 2007 11:50 PM
>> Subject: [Winpcap-users] How can I get the IP address of gateway
>> throughWinPcap
>>
>> How can I get the IP address of gateway through WinPcap
>> thanks very much
>>
>> ________________________________
>>
>>
>> _______________________________________________
>> Winpcap-users mailing list
>> Winpcap-users at winpcap.org
>> https://www.winpcap.org/mailman/listinfo/winpcap-users
>>
>>
>>
>> _______________________________________________
>> Winpcap-users mailing list
>> Winpcap-users at winpcap.org
>> https://www.winpcap.org/mailman/listinfo/winpcap-users
>>
>>
> _______________________________________________
> 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