Find the answer to your Linux question:
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.
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Posts
    1

    Passing IP options data to kernel from userspace


    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 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 ?

    -Kaushik

  2. #2
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •