typedef int socklen_t;
#endif
-#ifndef MSG_TRUNC
-/*
- * This is being compiled on a system that lacks MSG_TRUNC; define it
- * with the value it has in the 2.2 and later kernels, so that, on
- * those kernels, when we pass it in the flags argument to "recvfrom()"
- * we're passing the right value and thus get the MSG_TRUNC behavior
- * we want. (We don't get that behavior on 2.0[.x] kernels, because
- * they didn't support MSG_TRUNC.)
- */
-#define MSG_TRUNC 0x20
-#endif
-
-#ifndef SOL_PACKET
-/*
- * This is being compiled on a system that lacks SOL_PACKET; define it
- * with the value it has in the 2.2 and later kernels, so that we can
- * set promiscuous mode in the good modern way rather than the old
- * 2.0-kernel crappy way.
- */
-#define SOL_PACKET 263
-#endif
-
#define MAX_LINKHEADER_SIZE 256
/*
#define BIGGER_THAN_ALL_MTUS (64*1024)
/*
- * Private data for capturing on Linux SOCK_PACKET or PF_PACKET sockets.
+ * Private data for capturing on Linux PF_PACKET sockets.
*/
struct pcap_linux {
u_int packets_read; /* count of packets read with recvfrom() */
/*
* Stuff to do when we close.
*/
-#define MUST_CLEAR_PROMISC 0x00000001 /* clear promiscuous mode */
-#define MUST_CLEAR_RFMON 0x00000002 /* clear rfmon (monitor) mode */
-#define MUST_DELETE_MONIF 0x00000004 /* delete monitor-mode interface */
+#define MUST_CLEAR_RFMON 0x00000001 /* clear rfmon (monitor) mode */
+#define MUST_DELETE_MONIF 0x00000002 /* delete monitor-mode interface */
/*
* Prototypes for internal functions and methods.
* There's something we have to do when closing this
* pcap_t.
*/
- if (handlep->must_do_on_close & MUST_CLEAR_PROMISC) {
- /*
- * We put the interface into promiscuous mode;
- * take it out of promiscuous mode.
- *
- * XXX - if somebody else wants it in promiscuous
- * mode, this code cannot know that, so it'll take
- * it out of promiscuous mode. That's not fixable
- * in 2.0[.x] kernels.
- */
- memset(&ifr, 0, sizeof(ifr));
- pcap_strlcpy(ifr.ifr_name, handlep->device,
- sizeof(ifr.ifr_name));
- if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) == -1) {
- fprintf(stderr,
- "Can't restore interface %s flags (SIOCGIFFLAGS failed: %s).\n"
- "Please adjust manually.\n"
- "Hint: This can't happen with Linux >= 2.2.0.\n",
- handlep->device, strerror(errno));
- } else {
- if (ifr.ifr_flags & IFF_PROMISC) {
- /*
- * Promiscuous mode is currently on;
- * turn it off.
- */
- ifr.ifr_flags &= ~IFF_PROMISC;
- if (ioctl(handle->fd, SIOCSIFFLAGS,
- &ifr) == -1) {
- fprintf(stderr,
- "Can't restore interface %s flags (SIOCSIFFLAGS failed: %s).\n"
- "Please adjust manually.\n"
- "Hint: This can't happen with Linux >= 2.2.0.\n",
- handlep->device,
- strerror(errno));
- }
- }
- }
- }
-
#ifdef HAVE_LIBNL
if (handlep->must_do_on_close & MUST_DELETE_MONIF) {
ret = nl80211_init(handle, &nlstate, handlep->device);
static const char any_descr[] = "Pseudo-device that captures on all interfaces";
/*
- * A SOCK_PACKET or PF_PACKET socket can be bound to any network interface.
+ * A PF_PACKET socket can be bound to any network interface.
*/
static int
can_be_bound(const char *name _U_)