A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2002-07-27 01:12 AM

From: Colombia
Registered: 2002-06-12
Posts: 353

Re: 6.9 - IP header of a UDP message

From: Dmitri

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
security reasons.

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.

From: lore

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.


Board footer

Powered by FluxBB