Decapsulate GTP-U payload and forward to a Router

Andreas Schultz andreas.schultz@REDACTED
Mon Jul 6 09:06:18 CEST 2020


Am Mo., 6. Juli 2020 um 08:48 Uhr schrieb Papa Tana <papa.tana101@REDACTED
>:

> Yes! I already saw it, it's a really interested one.
>
> Someone else seems to manage to do it very well, and I'm still on the
> ongoing process of exploring this huge source code as well:
> https://github.com/travelping/ergw


>
> But actually, I don't need to create or manipulate, I need to
> decapsulate the user-data inside GTP-u (this I can do) and forward
> these data packets to external Router, "without changing any
> information".
>
> I am kind of the "default router" for some client equipment who is
> sending me packets in GTP-u format, I receive and decapsulate them,
> forward and don't have to look what are inside.
>
> I should have changed the title as "Erlang used as a  Router", but I
> wanted to illustrate my real scenario.
>

That is not an Erlang specific question. Using a user space process as
tunnel encap/decap or router would be more appropriate.

On Linux what you are looking for is called a TUN device (other OSes have
different mechanisms). A TUN device is controlled through a socket.

A quick search on github finds [1] which might or might not do what you
want.

Another option would be to use the Linux kernel GTP module. That module is
controlled through netlink messages. A sample of how this can work can be
found here [2].

For your specific use case, the 5G/CUPS way would be to use a UPF instance
and talk PFCP to it.

Regards
Andreas

[1]: https://github.com/msantos/tunctl
[2]: https://github.com/travelping/gtp_u_kmod


>
> 2020-07-06 4:13 UTC+03:00, Matthew Evans <mattevans123@REDACTED>:
> > Have you looked at the procket library? Lots of low-level socket
> > manipulation tools..
> >
> > https://github.com/msantos/procket
> >
> > Sent from my iPhone
> >
> > On Jul 5, 2020, at 8:56 PM, Papa Tana <papa.tana101@REDACTED> wrote:
> >
> > Hi All,
> >
> > I am a node built in Erlang, and I receive lots of GTP-U packets:
> >
> > ---> GTP-U packets ---------> My Node as a Relay ----> Router [using
> > NAT]----> Internet
> >
> > As shown above, the Erlang node task is to decapsulate the user data
> > (GTP-U Message Type is T-PDU (0xff)) and forward them to the Router,
> > without changing any information, just forward it, that's all.
> >
> > I was used to send application message in binary as a Client, just
> > using gen_udp and gen_tcp, but now, I am not the Client. And not the
> > server because those messages are not for me neither.
> >
> > => Then, after I decapsulate these messages from GTP-U, I would like
> > to relay these layer messages to the Router with which I am connected.
> > The Router should connect with me with one network interface, using
> > the same netmask, let's say a small /30 netmask, it's obvious.
> >
> > The IP addresses (src and dst) in the payload are not "from" me and
> > not "for" me.
> > Any tips please?
> >
> > Thank you,
> > Best Regards,
> >
>


-- 

Andreas Schultz

-- 

Principal Engineer

t: +49 391 819099-224

------------------------------- enabling your networks
-----------------------------

Travelping GmbH
Roentgenstraße 13
39108 Magdeburg
Germany

t: +49 391 819099-0
f: +49 391 819099-299

e: info@REDACTED
w: https://www.travelping.com/
Company registration: Amtsgericht Stendal
Managing Director: Holger Winkelmann
Reg. No.: HRB 10578
VAT ID: DE236673780
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200706/38115eeb/attachment.htm>


More information about the erlang-questions mailing list