I need to capture packets from all network interfaces on Linux machine.
In order to do it I'm planning to use pcap_open_live()
API and pass "any" as a device argument.
I have different types of ports: Ethernet ports (say eth0) and GRE tunnels (say tun0) The packets that coming from different types of interfaces has different headers format:
- Packets from Ethernet port has MAC header
- Packets from tunnel coming with a Linux "cooked" capture encapsulation (16 bytes) header
How can I check into pcap_loop()
callback handler what type of packet header I got?