First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

Understand when Wireshark is active on an interface on Linux

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

Francesco's avatar
1
Francesco
asked 2019-02-19 17:44:07 +0000
Guy Harris's avatar
19.9k
Guy Harris
updated 2019-02-19 20:56:04 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

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.

Guy Harris's avatar
19.9k
Guy Harris
answered 2019-02-19 21:21:36 +0000
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer