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!