Go Back   UNIX Socket FAQ > FAQ > UNIX Socket FAQ

Reply
 
Thread Tools Display Modes
  #1  
Old 07-27-2002, 12:12 AM
Loco Loco is offline
Old administrator
 
Join Date: Jun 2002
Location: Colombia
Posts: 351
Default 6.9 - IP header of a UDP message

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.

Thanks

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:14 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.