Linux.com

Home Linux Community Forums Programming and Development Software Development Turn off promiscuous mode console messages

Turn off promiscuous mode console messages

Link to this post 05 Apr 11

I created a thread to continually sniff certain network packets at the datalink layer every few seconds using libpcap. eth0 is being opened in promiscuous mode. I do not want to leave the pcap object open, so I am calling pcap_open_live() and pcap_close() each time in the loop. This results in

entered promiscuous mode
and
left promiscuous mode
messages continually printed to the console.
How do I turn off or delete these messages? I looked in the libpcap source code, but could not find these messages.

Link to this post 05 Apr 11

You can append "> /dev/null" at the end of each command to send the output to null so it will not be displayed.

Link to this post 05 Apr 11

Like mfillpot said, appending > /dev/null to your command will dispose of all output (stdout) of that command. If you also want to dispose of generated error messages (stderr), you can instead append &> /dev/null to completely silence your command.

If you're actually interested in the output your command produces, except all the messages regarding promiscuous mode, you can also just filter the command output by appending | grep -v 'promiscuous mode' to the end of your command.

Link to this post 06 Apr 11

I understand I can redirect to null in comand line or script. However, the message is being displayed during library call to pcap_open_live() in the libpcap library.
Anyways, I have found the printk statement in the kernel file /net/core/dev.c., function dev_set_promiscuity(). So, I just commented it out and rebuilt the kernel for my embedded system.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board