libs/libpcap: update to 1.8.1
Update libpcap to upstream release 1.8.1 Change the name from libpcap.so.1.3 to libpcap.so.1 Remove parts of patch 201 which moved code among src files. Import patch 204 from Debian to update the USB path. Signed-off-by: Paul Wassi <p.wassi@gmx.at> Signed-off-by: Felix Fietkau <nbd@nbd.name> [fix parallel build bug]
This commit is contained in:
		| @@ -1,6 +1,8 @@ | ||||
| This API extension is used by ead (Emergency Access Daemon) | ||||
|  | ||||
| --- a/pcap-linux.c | ||||
| +++ b/pcap-linux.c | ||||
| @@ -414,7 +414,7 @@ static int	iface_get_id(int fd, const ch | ||||
| @@ -425,7 +425,7 @@ static int	iface_get_id(int fd, const ch | ||||
|  static int	iface_get_mtu(int fd, const char *device, char *ebuf); | ||||
|  static int 	iface_get_arptype(int fd, const char *device, char *ebuf); | ||||
|  #ifdef HAVE_PF_PACKET_SOCKETS | ||||
| @@ -9,16 +11,16 @@ | ||||
|  #ifdef IW_MODE_MONITOR | ||||
|  static int	has_wext(int sock_fd, const char *device, char *ebuf); | ||||
|  #endif /* IW_MODE_MONITOR */ | ||||
| @@ -1028,7 +1028,7 @@ pcap_can_set_rfmon_linux(pcap_t *handle) | ||||
| @@ -1059,7 +1059,7 @@ pcap_can_set_rfmon_linux(pcap_t *handle) | ||||
|  	 * (We assume that if we have Wireless Extensions support | ||||
|  	 * we also have PF_PACKET support.) | ||||
|  	 */ | ||||
| -	sock_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); | ||||
| +	sock_fd = socket(PF_PACKET, SOCK_RAW, p->opt.proto); | ||||
|  	if (sock_fd == -1) { | ||||
|  		(void)snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, | ||||
|  		(void)pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, | ||||
|  		    "socket: %s", pcap_strerror(errno)); | ||||
| @@ -1337,6 +1337,9 @@ pcap_activate_linux(pcap_t *handle) | ||||
| @@ -1456,6 +1456,9 @@ pcap_activate_linux(pcap_t *handle) | ||||
|  	handle->read_op = pcap_read_linux; | ||||
|  	handle->stats_op = pcap_stats_linux; | ||||
|   | ||||
| @@ -28,7 +30,7 @@ | ||||
|  	/* | ||||
|  	 * The "any" device is a special device which causes us not | ||||
|  	 * to bind to a particular device and thus to look at all | ||||
| @@ -3160,8 +3163,8 @@ activate_new(pcap_t *handle) | ||||
| @@ -3335,8 +3338,8 @@ activate_new(pcap_t *handle) | ||||
|  	 * try a SOCK_RAW socket for the raw interface. | ||||
|  	 */ | ||||
|  	sock_fd = is_any_device ? | ||||
| @@ -39,16 +41,16 @@ | ||||
|   | ||||
|  	if (sock_fd == -1) { | ||||
|  		if (errno == EINVAL || errno == EAFNOSUPPORT) { | ||||
| @@ -3279,7 +3282,7 @@ activate_new(pcap_t *handle) | ||||
| @@ -3454,7 +3457,7 @@ activate_new(pcap_t *handle) | ||||
|  				return PCAP_ERROR; | ||||
|  			} | ||||
|  			sock_fd = socket(PF_PACKET, SOCK_DGRAM, | ||||
| -			    htons(ETH_P_ALL)); | ||||
| +			    handle->opt.proto); | ||||
|  			if (sock_fd == -1) { | ||||
|  				snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, | ||||
|  				pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, | ||||
|  				    "socket: %s", pcap_strerror(errno)); | ||||
| @@ -3343,7 +3346,7 @@ activate_new(pcap_t *handle) | ||||
| @@ -3518,7 +3521,7 @@ activate_new(pcap_t *handle) | ||||
|  		} | ||||
|   | ||||
|  		if ((err = iface_bind(sock_fd, handlep->ifindex, | ||||
| @@ -57,7 +59,7 @@ | ||||
|  		    	close(sock_fd); | ||||
|  			if (err < 0) | ||||
|  				return err; | ||||
| @@ -5050,7 +5053,7 @@ iface_get_id(int fd, const char *device, | ||||
| @@ -5271,7 +5274,7 @@ iface_get_id(int fd, const char *device, | ||||
|   *  or a PCAP_ERROR_ value on a hard error. | ||||
|   */ | ||||
|  static int | ||||
| @@ -66,7 +68,7 @@ | ||||
|  { | ||||
|  	struct sockaddr_ll	sll; | ||||
|  	int			err; | ||||
| @@ -5059,7 +5062,7 @@ iface_bind(int fd, int ifindex, char *eb | ||||
| @@ -5280,7 +5283,7 @@ iface_bind(int fd, int ifindex, char *eb | ||||
|  	memset(&sll, 0, sizeof(sll)); | ||||
|  	sll.sll_family		= AF_PACKET; | ||||
|  	sll.sll_ifindex		= ifindex; | ||||
| @@ -75,18 +77,18 @@ | ||||
|   | ||||
|  	if (bind(fd, (struct sockaddr *) &sll, sizeof(sll)) == -1) { | ||||
|  		if (errno == ENETDOWN) { | ||||
| @@ -6049,7 +6052,7 @@ activate_old(pcap_t *handle) | ||||
| @@ -6325,7 +6328,7 @@ activate_old(pcap_t *handle) | ||||
|   | ||||
|  	/* Open the socket */ | ||||
|   | ||||
| -	handle->fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL)); | ||||
| +	handle->fd = socket(PF_INET, SOCK_PACKET, handle->opt.proto); | ||||
|  	if (handle->fd == -1) { | ||||
|  		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, | ||||
|  		pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, | ||||
|  			 "socket: %s", pcap_strerror(errno)); | ||||
| --- a/pcap.c | ||||
| +++ b/pcap.c | ||||
| @@ -562,6 +562,7 @@ pcap_create_common(const char *source, c | ||||
| @@ -578,6 +578,7 @@ pcap_create_common(char *ebuf, size_t si | ||||
|  	p->opt.promisc = 0; | ||||
|  	p->opt.rfmon = 0; | ||||
|  	p->opt.immediate = 0; | ||||
| @@ -94,7 +96,7 @@ | ||||
|  	p->opt.tstamp_type = -1;	/* default to not setting time stamp type */ | ||||
|  	p->opt.tstamp_precision = PCAP_TSTAMP_PRECISION_MICRO; | ||||
|   | ||||
| @@ -725,6 +726,15 @@ pcap_get_tstamp_precision(pcap_t *p) | ||||
| @@ -771,6 +772,15 @@ pcap_get_tstamp_precision(pcap_t *p) | ||||
|  } | ||||
|   | ||||
|  int | ||||
| @@ -112,7 +114,7 @@ | ||||
|  	int status; | ||||
| --- a/pcap/pcap.h | ||||
| +++ b/pcap/pcap.h | ||||
| @@ -66,6 +66,7 @@ extern "C" { | ||||
| @@ -68,6 +68,7 @@ extern "C" { | ||||
|  #define PCAP_VERSION_MINOR 4 | ||||
|   | ||||
|  #define PCAP_ERRBUF_SIZE 256 | ||||
| @@ -120,21 +122,21 @@ | ||||
|   | ||||
|  /* | ||||
|   * Compatibility for systems that have a bpf.h that | ||||
| @@ -283,6 +284,7 @@ int	pcap_set_timeout(pcap_t *, int); | ||||
|  int	pcap_set_tstamp_type(pcap_t *, int); | ||||
|  int	pcap_set_immediate_mode(pcap_t *, int); | ||||
|  int	pcap_set_buffer_size(pcap_t *, int); | ||||
| +int	pcap_set_protocol(pcap_t *, unsigned short); | ||||
|  int	pcap_set_tstamp_precision(pcap_t *, int); | ||||
|  int	pcap_get_tstamp_precision(pcap_t *); | ||||
|  int	pcap_activate(pcap_t *); | ||||
| @@ -287,6 +288,7 @@ PCAP_API int	pcap_set_timeout(pcap_t *, | ||||
|  PCAP_API int	pcap_set_tstamp_type(pcap_t *, int); | ||||
|  PCAP_API int	pcap_set_immediate_mode(pcap_t *, int); | ||||
|  PCAP_API int	pcap_set_buffer_size(pcap_t *, int); | ||||
| +PCAP_API int	pcap_set_protocol(pcap_t *, unsigned short); | ||||
|  PCAP_API int	pcap_set_tstamp_precision(pcap_t *, int); | ||||
|  PCAP_API int	pcap_get_tstamp_precision(pcap_t *); | ||||
|  PCAP_API int	pcap_activate(pcap_t *); | ||||
| --- a/pcap-int.h | ||||
| +++ b/pcap-int.h | ||||
| @@ -109,6 +109,7 @@ struct pcap_opt { | ||||
|  	char	*source; | ||||
| @@ -111,6 +111,7 @@ struct pcap_opt { | ||||
|  	char	*device; | ||||
|  	int	timeout;	/* timeout for buffering */ | ||||
|  	int	buffer_size; | ||||
| +	int	proto;      /* protocol for packet socket (linux) */ | ||||
|  	u_int	buffer_size; | ||||
| +	int	proto;		/* protocol for packet socket (linux) */ | ||||
|  	int	promisc; | ||||
|  	int	rfmon;		/* monitor mode */ | ||||
|  	int	immediate;	/* immediate mode - deliver packets as soon as they arrive */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 p-wassi
					p-wassi