aboutsummaryrefslogtreecommitdiff
path: root/pcap-linux.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-10-14 16:05:05 -0700
committerGuy Harris <guy@alum.mit.edu>2019-10-14 16:05:05 -0700
commit26de3578c11f386be25a6858abb7ed1528f03807 (patch)
tree1342b2b73e9e3702134a81afd4d2a82f6882c198 /pcap-linux.c
parentf775748d268885709fe861bce90319fcc6244502 (diff)
Don't turn off promiscuous mode when exiting.
PF_PACKET sockets turn off promiscuous for you, and we now require PF_PACKET sockets, so we don't need to worry about turning it off when we exit.
Diffstat (limited to 'pcap-linux.c')
-rw-r--r--pcap-linux.c44
1 files changed, 2 insertions, 42 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index bd7ecf32..be27cab8 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -225,9 +225,8 @@ struct pcap_linux {
/*
* 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.
@@ -1120,45 +1119,6 @@ static void pcap_cleanup_linux( pcap_t *handle )
* 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);