Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Nov 2008 13:51:25 -0800
From:      "Maksim Yevmenkin" <maksim.yevmenkin@gmail.com>
To:        "Randall Stewart" <rrs@lakerest.net>
Cc:        freebsd-net <freebsd-net@freebsd.org>, Julian Elischer <julian@elischer.org>
Subject:   Re: Thinking about UDP and tunneling
Message-ID:  <bb4a86c70811191351r26b5d35eha14d3cc8e0a697ef@mail.gmail.com>
In-Reply-To: <0252A647-464E-46A7-94E9-A0639083B5AE@lakerest.net>
References:  <D72E9703-C8E7-4A21-A71E-A4B4C2D7E8F4@lakerest.net> <49245EE3.2000700@elischer.org> <B08E77C5-CF11-42EE-9F9A-5E428CECF284@lakerest.net> <49247BEE.4040201@elischer.org> <bb4a86c70811191320l261981b9yc108474189d1cfa3@mail.gmail.com> <0252A647-464E-46A7-94E9-A0639083B5AE@lakerest.net>

next in thread | previous in thread | raw e-mail | index | archive | help
[...]

> > > just those that go to that ksocket.  we hook on at the socketbuf point.
> > >
> >
> > that's right. basically, use ng_ksocket(4). that would be your tunnel
> > (outer) endpoint which you would bind to udp protocol, given address
> > and port. now everything that remote tunnel (outer) endpoint will send
> > via udp (payload) will end up in ng_ksocket(4) node and will be sent
> > out to ksocket's hook.  you can connect whatever you want to that
> > hook. either move payload back into userspace, or use another ng node,
> > or just inject the data directly into sctp/etc. input routine. reverse
> > path is the same. playload comes from the hook and gets sent out via
> > udp
> >
>
>
>  Ok, let me go read the ng_ man..
>
>  I would not use the reverse path.. the ability to send
>  encap'd udp packets is already in sctp.. after all all you
>  are doing is dropping an extra header on it.. SCTP (and other
>  transports) will want to control the way the IP header looks.. at
>  least if they are multi-homed... so I don't think one would
>  want to do output via ng.. just getting the data in is all
>  thats missing in FreeBSD..

in this case its even easier. if you do not need reverse path, then
all you need to do is to write a very small ng_ node that would

1) connect to the ng_ksocket(4) node's hook; and
2) inject received data into sctp/etc. input path

so, you graph would look like

[ng_ksocket] <- inet/dgram/udp -> [ng_sctp_injector]

you might need an injector node do decouple netgraph from the rest of
the sctp/etc. stack. alternatively, you may wish to provide netgraph
hooks into sctp/etc. stack.

>  As long as netgraph is in generic this may work..

it is generic to some degree. if inner protocol (i.e. sctp etc.) is
not aware of netgraph, then you will need to write an injector node
specific to each inner protocol (basically that knows how to inject
data into the stack).  since injector node is simple, you could teach
it to deal with multiple inner transports. for example, you could have
an injector node that have multiple input hooks, one for each
supported inner transport, named "sctp", etc. the idea would be that
everything received from "sctp" hook will be injected into sctp stack,
etc. then you could have only one injector node that could deal with
multiple ng_ksockets for different inner transports.

thanks,
max



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