Ask Your Question
0

Understand when Wireshark is active on an interface on Linux

asked 2019-02-19 17:44:07 +0000

updated 2019-02-19 20:56:04 +0000

Guy Harris gravatar image

My OS is Linux, and I would like to understand via netlink messages when Wireshark is active on an interface. Do you know what happens when Wireshark is activated and what kind of netlink messages does the kernel send to alert applications? Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-02-19 21:21:36 +0000

Guy Harris gravatar image

Do you know what happens when Wireshark is activated

This is Linux, so:

It (or, rather, the libpcap library it uses) opens a PF_PACKET socket and binds it to the interface - or, if you're capturing on the "any" device, doesn't bind it - and starts getting packets from it.

If you're capturing in promiscuous mode, Wireshark (or, rather, the libpcap library) does a PACKET_ADD_MEMBERSHIP setsockopt() call, with a type of PACKET_MR_PROMISC, to put the interface into promiscuous mode.

and what kind of netlink messages does the kernel send to alert applications?

From a very quick look at the kernel code, it might only send a netlink message for the change to promiscuous mode (and the change from promiscuous mode from libpcap when Wireshark closes the device), so you may only see netlink messages if Wireshark puts the interface into promiscuous mode.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2019-02-19 17:44:07 +0000

Seen: 294 times

Last updated: Feb 19 '19