Socket Interface

layers


Raw sockets

Kernel offers two ways to forge packets:

Layer 3 - PF_INET, SOCK_RAW
- Classic raw sockets.
- Lotsa hand holding by kernel which inturn limits what you can do.

Layer 2 - PF_PACKET, PF_RAW
- There is no limit on what you send.
- No hand holding by kernel.
- You are responsible for choosing interfaces, linktypes, ARP stuff, calculate checksums…