How An Application Sets The Ip Options???

Hello Friends,
I'm involved in test the UDP/IP source code.
As you might be knowing, IPv4 provides several options: like Loose Source and Record Route (LSRR), Strict Source and Record Route (SSRR) etc.
I wanted to test the above mentioned IP options.
My strategy is to write a test application on top of the UDP/IP stack and enable the LSRR and send the datagrams. By monitoring the network traffic (using a tool such as ethereal) we can find out whether those options are working correctly or not.
But my problem is: HOW AN APPLICATION SETS THE IP OPTIONS???
BSD provides functions such as getsockopt and setsockopt to change the default behaviour of sockets. But If I see the man page of setsockopt, there are no options to set the above two IP options!!

Can any one please let me know how an application enable LSRR & SSRR IPv4 options.

Thanks in Advance.

Regards,
Md. Aamir Ali
Bangalore

You may go through chapter 27 of UNIX Network programming. There author explains get/set of ip options with example.

You use following URL for softcopy.
Unix Network Programming, Vol. 1: The Sockets Networking API | Free eBooks Download!

  • Dheeraj

Thanks Dheeraj,
That book is very useful.
Another thing, any idea about how to set Don't Fragment flag in IP Packet??

Thanks in Advance.

Regards,
Aamir

I guess there is no way to do this using socket options. I think you would have use raw sockets for that case.

  • Dheeraj