3

I'm new on work with linux. I want capture the ethernet packets above the device drivers layer.

I know that all the packets pass through the functions "dev_queue_xmit" to transmit the packet to the upper layer and the function "netfi_rx" for recieving the packet.

How can i "hook" this function to control the ethernet traffic?

what should i work with to accomplish this task?

Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149
Ricardo
  • 612
  • 2
  • 9
  • 16

2 Answers2

2

You might want to check out libpcap (a portable C/C++ library for network traffic capture). There is also an example.

perreal
  • 94,503
  • 21
  • 155
  • 181
1

You might want to use raw sockets. http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html

See also this question

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547