for using PACKET_AUXDATA cmsgs.
Olaf Kirch <okir at caldera dot de>
Ollie Wild <aaw at users dot sourceforge dot net>
Onno van der Linden <onno at simplex dot nl>
Olaf Kirch <okir at caldera dot de>
Ollie Wild <aaw at users dot sourceforge dot net>
Onno van der Linden <onno at simplex dot nl>
- Patrick Marie <mycroft at virgaria dot org>
Paolo Abeni <paolo dot abeni at email dot it>
Paolo Abeni <paolo dot abeni at email dot it>
+ Patrick Marie <mycroft at virgaria dot org>
+ Patrick McHardy <kaber at trash not net>
Paul Mundt <lethal at linux-sh dot org>
Pavel Kankovsky <kan at dcit dot cz>
Pawel Pokrywka <publicpp at gmail dot com>
Paul Mundt <lethal at linux-sh dot org>
Pavel Kankovsky <kan at dcit dot cz>
Pawel Pokrywka <publicpp at gmail dot com>
#ifndef lint
static const char rcsid[] _U_ =
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.129.2.21 2008-07-01 08:04:03 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.129.2.22 2008-08-06 07:40:20 guy Exp $ (LBL)";
#else
struct sockaddr from;
#endif
#else
struct sockaddr from;
#endif
int packet_len, caplen;
struct pcap_pkthdr pcap_header;
int packet_len, caplen;
struct pcap_pkthdr pcap_header;
+ struct iovec iov;
+ struct msghdr msg;
#ifdef HAVE_PF_PACKET_SOCKETS
/*
* If this is a cooked device, leave extra room for a
#ifdef HAVE_PF_PACKET_SOCKETS
/*
* If this is a cooked device, leave extra room for a
* get notified of "network down" events.
*/
bp = handle->buffer + handle->offset;
* get notified of "network down" events.
*/
bp = handle->buffer + handle->offset;
+
+ msg.msg_name = &from;
+ msg.msg_namelen = sizeof(from);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
+ msg.msg_flags = 0;
+
+ iov.iov_len = handle->bufsize - offset;
+ iov.iov_base = bp + offset;
+
do {
/*
* Has "pcap_breakloop()" been called?
do {
/*
* Has "pcap_breakloop()" been called?
handle->break_loop = 0;
return -2;
}
handle->break_loop = 0;
return -2;
}
- fromlen = sizeof(from);
- packet_len = recvfrom(
- handle->fd, bp + offset,
- handle->bufsize - offset, MSG_TRUNC,
- (struct sockaddr *) &from, &fromlen);
+
+ packet_len = recvmsg(handle->fd, &msg, MSG_TRUNC);
} while (packet_len == -1 && (errno == EINTR || errno == ENETDOWN));
/* Check if an error occured */
} while (packet_len == -1 && (errno == EINTR || errno == ENETDOWN));
/* Check if an error occured */