Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2006 18:23:15 -0800
From:      Haisang Wu <haisang@gmail.com>
To:        freebsd-net@freebsd.org.
Subject:   Developing New Socket Option on 4.10
Message-ID:  <de1c88480601241823l5a382c09i2e296c9f30e95292@mail.gmail.com>

index | next in thread | raw e-mail

Hello, all,

  I am writing for help on my freebsd kernel hacking. I am working on 4.10,
and intend to introduct a new socket option (say, SO_TAG_PAK)
for my own kernel. When sending out a packet, if this option is set, the
socket layer will produce a 20-byte tag, and finally this tag will be
prepended before IP header (may be done in ip_output() ). This is somewhat
like MPLS's shim layer, but this special packet with the tag will only be
sent over a logical tunnel to another system. When receiving a packet, the
IP layer will check whether the packet has this tag (through the
first integer of the tag), and pass the tag up (to applications).

  For future possible extensions, I introduced a flag, so_tag_pak_flag, into
"struct socket".  I modified sosetopt() to set so->so_tag_pak_flag=0x1 when
(sopt->sopt_name == SO_TAG_PAK). I will write a function so_tagpak( ) to
generate the 20-byte tag. This tag will be kept in the kernel
space, and later be prepended to the IP packet in function ip_output( ).

  I have a few questions below:

At sending direction:

1. Should I allocate a separate mbuf for this tag inside so_tagpak( )?
2. The function so_tagpak( ) should be called in the socket layer so the
socket can check the flag and produce the tag.
    Where should it be called?
3. In ip_output( ), can I prepend this tag (i.e., a separate mbuf) before
the IP header? Could you give me some suggestions on how to do so?

At receiving direction:

4. Can I detect the tag in ipintr( )? How will be the mbuf operation here?

  Thank you very much for your help!

Haisang


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?de1c88480601241823l5a382c09i2e296c9f30e95292>