mirror of
https://github.com/nmap/nmap.git
synced 2025-12-27 18:09:01 +00:00
Update libpcap to 1.10.5
This commit is contained in:
@@ -32,9 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -60,7 +58,7 @@
|
||||
* we end up including both the OS's <net/bpf.h> and our <pcap/bpf.h>,
|
||||
* and their definitions of some data structures collide.
|
||||
*/
|
||||
#if (defined(linux) || defined(__Lynx__)) && defined(AF_PACKET)
|
||||
#if (defined(__linux__) || defined(__Lynx__)) && defined(AF_PACKET)
|
||||
# ifdef HAVE_NETPACKET_PACKET_H
|
||||
/* Linux distributions with newer glibc */
|
||||
# include <netpacket/packet.h>
|
||||
@@ -75,7 +73,7 @@
|
||||
# include <linux/if_packet.h>
|
||||
# endif /* __Lynx__ */
|
||||
# endif /* HAVE_NETPACKET_PACKET_H */
|
||||
#endif /* (defined(linux) || defined(__Lynx__)) && defined(AF_PACKET) */
|
||||
#endif /* (defined(__linux__) || defined(__Lynx__)) && defined(AF_PACKET) */
|
||||
|
||||
/*
|
||||
* This is fun.
|
||||
@@ -99,6 +97,17 @@
|
||||
* but not in the final version). On the latter systems, we explicitly
|
||||
* check the AF_ type to determine the length; we assume that on
|
||||
* all those systems we have "struct sockaddr_storage".
|
||||
*
|
||||
* OSes that use this file are:
|
||||
* - FreeBSD (HAVE_STRUCT_SOCKADDR_SA_LEN is defined)
|
||||
* - Haiku (HAVE_STRUCT_SOCKADDR_SA_LEN is defined)
|
||||
* - Hurd (HAVE_STRUCT_SOCKADDR_SA_LEN is defined)
|
||||
* - illumos (HAVE_STRUCT_SOCKADDR_SA_LEN is not defined)
|
||||
* - Linux (HAVE_STRUCT_SOCKADDR_SA_LEN is not defined)
|
||||
* - macOS (HAVE_STRUCT_SOCKADDR_SA_LEN is defined)
|
||||
* - NetBSD (HAVE_STRUCT_SOCKADDR_SA_LEN is defined)
|
||||
* - OpenBSD (SA_LEN() is defined)
|
||||
* - Solaris 11 (HAVE_STRUCT_SOCKADDR_SA_LEN is not defined)
|
||||
*/
|
||||
#ifndef SA_LEN
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
|
||||
@@ -120,11 +129,16 @@ get_sa_len(struct sockaddr *addr)
|
||||
return (sizeof (struct sockaddr_in6));
|
||||
#endif
|
||||
|
||||
#if (defined(linux) || defined(__Lynx__)) && defined(AF_PACKET)
|
||||
#if (defined(__linux__) || defined(__Lynx__)) && defined(AF_PACKET)
|
||||
case AF_PACKET:
|
||||
return (sizeof (struct sockaddr_ll));
|
||||
#endif
|
||||
|
||||
#ifdef AF_LINK
|
||||
case AF_LINK:
|
||||
return (sizeof (struct sockaddr_dl));
|
||||
#endif
|
||||
|
||||
default:
|
||||
return (sizeof (struct sockaddr));
|
||||
}
|
||||
@@ -143,7 +157,7 @@ get_sa_len(struct sockaddr *addr)
|
||||
* could be opened.
|
||||
*/
|
||||
int
|
||||
pcap_findalldevs_interfaces(pcap_if_list_t *devlistp, char *errbuf,
|
||||
pcapint_findalldevs_interfaces(pcap_if_list_t *devlistp, char *errbuf,
|
||||
int (*check_usable)(const char *), get_if_flags_func get_flags_func)
|
||||
{
|
||||
struct ifaddrs *ifap, *ifa;
|
||||
@@ -167,7 +181,7 @@ pcap_findalldevs_interfaces(pcap_if_list_t *devlistp, char *errbuf,
|
||||
* those.
|
||||
*/
|
||||
if (getifaddrs(&ifap) != 0) {
|
||||
pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
|
||||
pcapint_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
|
||||
errno, "getifaddrs");
|
||||
return (-1);
|
||||
}
|
||||
@@ -263,7 +277,7 @@ pcap_findalldevs_interfaces(pcap_if_list_t *devlistp, char *errbuf,
|
||||
/*
|
||||
* Add information for this address to the list.
|
||||
*/
|
||||
if (add_addr_to_if(devlistp, ifa->ifa_name, ifa->ifa_flags,
|
||||
if (pcapint_add_addr_to_if(devlistp, ifa->ifa_name, ifa->ifa_flags,
|
||||
get_flags_func,
|
||||
addr, addr_size, netmask, addr_size,
|
||||
broadaddr, broadaddr_size, dstaddr, dstaddr_size,
|
||||
|
||||
Reference in New Issue
Block a user