You are not logged in.
I'm stuck trying to figure out how to read the IP header of
each UDP packet I get on a normal SOCK_DGRAM socket. The field
of interest is the TTL field from the IP header. Of course
using RAW sockets would help, but they require root access on
most Unix boxes.
From: E McWhorter
You don't ordinarily have access to IP packets at the
application layer. If you must have network data at this
level, the interface is OS-dependant. On a berkeley-like
box, you'll use Berkeley Packet Filters, which must be
installed by the sys admin. On a sys V box, you'll use
a STREAMS filter, which also must be installed by the sys
admin. These devices are not generally installed for
From: Bruce M. Simpson
Yes, you'll need root or sufficient privilege for this.
On new Linux/BSD boxes I configure, I patch the kernel to
use a group privilege model for raw socketness, to save
really bad things happening.
libnet and libpcap are your friends here. Check them out.
In Linux, you can use SOCK_PACKET to receive IP headers
upwards, (or even ethernet headers if you ioctl the socket
and set promiscuous mode), but this requires root access.