A question about ip_options's option type

Guibin(Bill) Tian gbtian at gmail.com
Fri Dec 13 20:00:15 EST 2013


Hi, maybe it's a naive question. But I am confused here.

For the options field of an IP header, as for the data in this field,
according to document and the code in the method of "ip_options_compile",
the first byte is  the options type data and the second byte is the length
of the option. But I traced back the method of "ip_options_get_from_user",
there is no place that assign these two values to the __data field.

I checked some example of socket API "setsockopt", it also just converts
the target options data pointer into a char * pointer and passes down to "
ip_options_get_from_user", still it doesn't set these two values.

Can anyone help me on this? Because I am trying to add my own options to IP
header at the IP layer for some experiment purposes.


struct linger linger = { 0 };
linger.l_onoff = 1;
linger.l_linger = 30;
status = setsockopt(serverSocket,
SOL_SOCKET, SO_LINGER,
(const char *) &linger,
sizeof(linger));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131213/1e2fc121/attachment.html 


More information about the Kernelnewbies mailing list