Raw Sockets
Raw Sockets
Raw Sockets
Vivek Ramachandran
A day in the life of Network Packet
The gory details …..
Problem formulation- why raw
sockets ?
• We can only receive frames destined to us
Application
Raw Socket
What are raw sockets ?
• Simply put raw sockets provide a way to
bypass the whole network stack traversal
of a packet and deliver it directly to an
application.
• There are many ways to create raw
sockets. We will concentrate on the
PF_PACKET interface for creating raw
sockets.
PF_PACKET
• It is a software interface to send/receive
packets at layer 2 of the OSI i.e. device
driver.
• All packets received will be complete with
all headers and data.
• All packets sent will be transmitted without
modification by the kernel to the medium.
• Supports filtering using Berkley Packet
Filters.
Creating a Raw Socket
• Call socket() with appropriate arguments.