Results 1 to 2 of 2
Hello, I need to put some IP options data as part of each IP packet. Browsing through some sources, it looks like setsockopt() can be used to pass the data ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-26-2007 #1
- Join Date
- Dec 2007
Passing IP options data to kernel from userspace
I need to put some IP options data as part of each IP packet. Browsing through some sources, it looks like setsockopt() can be used to pass the data to be put into thte IP options header to the kernel from user application.
I then tried a sending a single IP packet after doing socket(2) call by doing
setsockopt(sockfd, IPPROTO_IP, IP_OPTIONS, &data, sizeof(data)) and captured the packet at the receiver end using ethereal but there was no IP otions header at the packet received.
Can somebody help me out with how to send the IP options data from userland to kernel so that kernel creates the IP options header and puts the data in there ?
- 01-03-2008 #2
You have to set up a special structure that I believe from my memory is common to the kernel and the userspace.
Also, there exist small functions or macros that test beforehand that everything is OK to do that ioctl call.
I remember having given detailed examples for that stuff here in that forum, but now I am too lazy to dig that out again.Bus Error: Passengers dumped. Hech gap yo'q.