Fix for WinPcap 3.1 beta breakage of libnet_get_ipaddr4
"Kirby Kuehl" <[email protected]>
| Newsgroups | gmane.comp.security.libnet |
|---|---|
| Organization | Cisco Systems, Inc. |
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Winpcap 3.1 beta has migrated from PacketGetNetInfo() to
PacketGetNetInfoEx(). Ifyou have migrated to WinPcap 3.1beta and have
experienced any problems, copy and paste the function below (it is
short enough that I didn't create a diff).
I have not applied this change to CVS yet as the API change is NOT
backwards compatible.
Kirby
libnet_get_ipaddr4(libnet_t *l)
{
ULONG ip = 0, netmask = 0;
long npflen = 0;
struct sockaddr_in sin;
struct npf_if_addr ipbuff;
memset(&sin,0,sizeof(sin));
memset(&ipbuff,0,sizeof(ipbuff));
npflen = sizeof(ipbuff);
if(PacketGetNetInfoEx(l->device, &ipbuff, &npflen))
{
sin =*(struct sockaddr_in *)&ipbuff.IPAddress;
}
return(sin.sin_addr.s_addr);
}
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3
iQA/AwUBQDJ/q/JlWu/m+KZxEQKaWwCeN3q3382CB/KvyFhdooP5Gz56SpYAnRgj
YRLs4RTL5gMxNbTOP0/U2XaI
=gh1l
-----END PGP SIGNATURE-----