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 _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]"