Networking Forums

Networking Forums > Computer Networking > Linux Networking > Retrieve TOS from IP Header

Reply
Thread Tools Display Modes

Retrieve TOS from IP Header

 
 
aquadisco
Guest
Posts: n/a

 
      04-03-2008, 02:19 PM
For a simple lab test, I need to retrieve the TOS value from an
incoming packet. I have figured out how to *set* TOS for a socket
through the "setsockopt" call using SOL_IP and IP_TOS. It *appears*
that there is an IP_RECVTOS option which will retrieve this TOS value
through an ancillary message (which I don't really understand). I've
tried to set this IP_RECVTOS to true and suck down the ancillary
message with the "recvmsg" function. However, I really don't know
what I'm doing. My test program never receives anything from
recvmsg. Can anyone tell me if a) I'm on the right track or b) there
is an easier/better way to get the TOS value from a received packet.

Here are the highlights of my test program.
================================================== =============

int OptVal = 1;

- Setup UDP Receive Socket
- Set socket to Blocking
- Setup setsockopt (client_sock,SOL_IP, IP_RECVTOS, &OptVal,
sizeof(int));
- Setup poll function
- Exit Poll when new data available on socket
- attempt to pull down ancillary message
MsgBytes = recvmsg (client_sock,&msgh, 0);

================================================== =============

.... and at this point i expect to find a msgh struct with cmsg
elements, but i don't find anything. Is my method wrong?


Thanks!
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieve DHCP list Joris De Groote Windows Networking 1 05-18-2006 03:54 PM
Unable to retrieve server list from DCSERVER: 53 MySwee Windows Networking 1 01-25-2006 06:37 PM
linux cooked header to ethernet header conversion makwak Linux Networking 0 05-10-2005 12:36 PM
How can i retrieve more Information about Ethernet Adapter. Rajesh Gupta Windows Networking 0 09-03-2004 01:12 AM
How to retrieve the NIC name MatB Linux Networking 3 04-30-2004 08:31 AM



1 2 3 4 5 6 7 8 9 10 11