I'm trying to write a simple program that takes a packet from an interface and prints out its destination and source MAC addresses at the Linux Kernel level. This is my first project working with the Linux Kernel and I have been reading through a lot of source code and books to do with netdevice, loopback and skbuff. Now, from what I have learnt so far skbuff looks like where packet data is placed, but I cannot see how a network device driver takes packets from an interface and places them into an skb or how you get skb's related with a particular interface.
Could someone tell me how I look at skb's linked to a netdevice such as eth0? Is there some sort of transmit and receive ring I need to pick them up off?
Some sample code would be amazing! Failing that, if someone could point to a some source code (more than just the filename...line number and function name would be great).
Sorry if this is a vague question I have tried to research as much as I can. Thanks in advance.