Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Mar 2001 06:15:22 -0800
From:      Julian Elischer <julian@elischer.org>
To:        Harti Brandt <brandt@fokus.gmd.de>
Cc:        Marco Molteni <molter@tin.it>, freebsd-net@FreeBSD.ORG
Subject:   Re: How to implement a transport protocol with netgraph? (2)
Message-ID:  <3A9E597A.D3387FC2@elischer.org>
References:  <Pine.BSF.4.33.0103011334480.37362-100000@beagle.fokus.gmd.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Harti Brandt wrote:
> 
> On Thu, 1 Mar 2001, Marco Molteni wrote:
> 
> MM>[Since I didn't received a reply on my first posting, I am trying once more]
> MM>
> MM>Hi all,
> MM>
> MM>I have to implement a kernel version of the transport protocol SCTP
> MM>(Stream Control Transmission Protocol, RFC 2960), plus a socket
> MM>interface to it as in draft-ietf-stewart-sctpsocket-sigtran-01.txt
> MM>(the RFC has an ad hoc user interface).
> MM>
> MM>It seems to me that the modularity of netgraph would help a lot in
> MM>this project, as opposed to go hacking half the kernel networking
> MM>stack to put SCTP in it (and yes, this is my first big project in
> MM>kernel land).

good luck! We all start somewhere.

> MM>
> MM>I read the netgraph blueprint article on Daemonnews and the various
> MM>netgraph manpages. The problem is that all the examples and
> MM>applications I could find are layer 2 and layer 3, there is no example
> MM>of a transport protocol done with netgraph.

that is true.
Netgraph ws designed to be a link-layer framework, but it turns out that
it can also be used for complete protocols.

> MM>
> MM>Since SCTP is reliable, at the very minimum I will have to handle
> MM>timers, buffers, retransmissions and friends.

you can certainly do that in netgraph.
there are issues with locking in that a timer must not jump into a node while
the node is locked, but there is a method for doing that. I will be adding more 
support for it so that it is easier to do. Add a small 'stub' function that does
nothing but call the 'real' timer function through the locking mechanism.


> MM>
> MM>So my questions are:
> MM>
> MM>o Any example of a transport protocol done with netgraph, or any hints
> MM>  (the more detailed the better :-) on how to tackle this task? Is
> MM>  netgraph suited for this (I think yes) ?

not at the moment.

> MM>
> MM>o Let's say the socket interface will be something like
> MM>  sd = socket(PF_INET, SOCK_STREAM, IPPROTO_SCTP)
> MM>  How (or where) do I connect the socket system call to the netgraph
> MM>  framework?

make something that looks a bit like the ng_socket node type.
but it can be a lot simpler as you won;t need two channels (control+data)
you would have only ONE such node in a system and new sockets of that type
would attach to that node (inside the module) just like tcp does.

You may find that netgraph sockets give you a pointer in how to make a loadable 
protocol module, but they will have to be different too.
check out divert sockets as another example of a simple protocol.
(but it is connected to IP in some way)

Hopefully I can help if you have problems

> MM>
> MM>Thanks for the help
> MM>Marco
> 
> I have implemented SSCOP for ATM signalling in netgraph lately. If it
> helps you, I can send you the current code. There are however still a
> number of issues:
> 
> - It has no socket interface yet. I plan to do one base on the ng_socket
>   code. There should be a lot of similarities.

why can you not use the netgraph sockets?

> 
> - How to do flow control is not very clear up to now. There are a number
>   of messages defined in netgraph.h for this and I have used them, but
>   had no time to do a thourough test.

flow control has been added to -current using the messages you saw but 
support is still not in most nodes. Only tee and UI nodes know how to pass them
on...

hopefully people who find that node type 'X' blocks their flow control messages
can add the code to support them to 'X' and send me the diffs :-)

I'm also looking to add some mechanism that makes this trivial but I
don't know what it will be yet.

> 
> harti
> --
> harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private
>               brandt@fokus.gmd.de, harti@begemot.org
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-net" in the body of the message

-- 
      __--_|\  Julian Elischer
     /       \ julian@elischer.org
    (   OZ    ) World tour 2000-2001
---> X_.---._/  
            v

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




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