2002-01-31 04:48:43

by Marek Zawadzki

[permalink] [raw]
Subject: Implementing [options] field in a transport protocol's header.

Hello,

2.4.17 kernel.
I am having troubles understanding how to implement 'options' field
(of possibly variable length) in my transport protocol's header.
For the fixed-size fields I just extend the structure describing
my packet's header (say, struct udphdr) and it works fine.

I know I'll need a function similar to net/ipv4/tcp_input.c :
tcp_parse_options. I believe I'll have to do the parsing of 'skb->data' in
my receiving function, but how do I (if at all) decribe those options
in include/linux/skbuff.h : skbuff structure? I mean, tcp, for instance,
doesn't have any options defined in struct tcphdr, but the options
_are_the part of a packet's header (and tcphdr is actually used to get a
pointer to them later on)...

Which part of the code actually separate the options (which
apparently are not defined in the structure describing the header) from
the user's data, and also at which point should I inject my options when
sending a packet (in such a way so I don't overwrite user's data)?
I use UDP implementation as my base, so please refer to it, if possible.

I'll appreciate any help.

-marek