<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mo., 6. Juli 2020 um 09:34 Uhr schrieb Papa Tana <<a href="mailto:papa.tana101@gmail.com">papa.tana101@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Andreas,<br>
<br>
To be honest, your works are my triggering point, and so far, I am<br>
definitely checking out all of them as reference point: gtplib,<br>
pfcplib, ergw, gtp_u_kmod, etc....<br></blockquote><div><br></div><div>Glad that you find them helpful. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Before Erlang, I was using Scapy, and Linux tun driver to establish a<br>
simple GRE tunnel.<br>
<br>
I never knew Erlang before, I manage some SGSN/MME and GGSN/PGW, HSS<br>
etc..., and I am not a developer neither, but I came across Erlang by<br>
June 2020 and after just 1 week of using it, I was definitely<br>
convinced by its strength, and now, I was hoping that I could do all<br>
of these stuff with Erlang, my fault..<br>
<br>
Currently, because it's my first real personal project after some<br>
personal tutorials like DNS, NTP, ASN.1, I do hope that maybe on long<br>
run, if 3G GGSN is ok, I will go for 4G LTE PDN-GW and 5G UPF as well<br>
but in very very long run.<br>
<br>
Really appreciated!<br>
<br>
So Ok, I take notes of your precious advice:<br>
<br>
- Linux kernel GTP module is the way to go<br></blockquote><div><br></div><div>One advice, if you plan to ever support 3GPP charging (online or offline), don't bother with the kernel module. Implementing the needed accounting rules in the kernel is just too hard.</div><div><br></div><div>Andreas</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Best Regards,<br>
<br>
<br>
2020-07-06 10:06 UTC+03:00, Andreas Schultz <<a href="mailto:andreas.schultz@travelping.com" target="_blank">andreas.schultz@travelping.com</a>>:<br>
> Am Mo., 6. Juli 2020 um 08:48 Uhr schrieb Papa Tana <<a href="mailto:papa.tana101@gmail.com" target="_blank">papa.tana101@gmail.com</a><br>
>>:<br>
><br>
>> Yes! I already saw it, it's a really interested one.<br>
>><br>
>> Someone else seems to manage to do it very well, and I'm still on the<br>
>> ongoing process of exploring this huge source code as well:<br>
>> <a href="https://github.com/travelping/ergw" rel="noreferrer" target="_blank">https://github.com/travelping/ergw</a><br>
><br>
><br>
>><br>
>> But actually, I don't need to create or manipulate, I need to<br>
>> decapsulate the user-data inside GTP-u (this I can do) and forward<br>
>> these data packets to external Router, "without changing any<br>
>> information".<br>
>><br>
>> I am kind of the "default router" for some client equipment who is<br>
>> sending me packets in GTP-u format, I receive and decapsulate them,<br>
>> forward and don't have to look what are inside.<br>
>><br>
>> I should have changed the title as "Erlang used as a Router", but I<br>
>> wanted to illustrate my real scenario.<br>
>><br>
><br>
> That is not an Erlang specific question. Using a user space process as<br>
> tunnel encap/decap or router would be more appropriate.<br>
><br>
> On Linux what you are looking for is called a TUN device (other OSes have<br>
> different mechanisms). A TUN device is controlled through a socket.<br>
><br>
> A quick search on github finds [1] which might or might not do what you<br>
> want.<br>
><br>
> Another option would be to use the Linux kernel GTP module. That module is<br>
> controlled through netlink messages. A sample of how this can work can be<br>
> found here [2].<br>
><br>
> For your specific use case, the 5G/CUPS way would be to use a UPF instance<br>
> and talk PFCP to it.<br>
><br>
> Regards<br>
> Andreas<br>
><br>
> [1]: <a href="https://github.com/msantos/tunctl" rel="noreferrer" target="_blank">https://github.com/msantos/tunctl</a><br>
> [2]: <a href="https://github.com/travelping/gtp_u_kmod" rel="noreferrer" target="_blank">https://github.com/travelping/gtp_u_kmod</a><br>
><br>
><br>
>><br>
>> 2020-07-06 4:13 UTC+03:00, Matthew Evans <<a href="mailto:mattevans123@hotmail.com" target="_blank">mattevans123@hotmail.com</a>>:<br>
>> > Have you looked at the procket library? Lots of low-level socket<br>
>> > manipulation tools..<br>
>> ><br>
>> > <a href="https://github.com/msantos/procket" rel="noreferrer" target="_blank">https://github.com/msantos/procket</a><br>
>> ><br>
>> > Sent from my iPhone<br>
>> ><br>
>> > On Jul 5, 2020, at 8:56 PM, Papa Tana <<a href="mailto:papa.tana101@gmail.com" target="_blank">papa.tana101@gmail.com</a>> wrote:<br>
>> ><br>
>> > Hi All,<br>
>> ><br>
>> > I am a node built in Erlang, and I receive lots of GTP-U packets:<br>
>> ><br>
>> > ---> GTP-U packets ---------> My Node as a Relay ----> Router [using<br>
>> > NAT]----> Internet<br>
>> ><br>
>> > As shown above, the Erlang node task is to decapsulate the user data<br>
>> > (GTP-U Message Type is T-PDU (0xff)) and forward them to the Router,<br>
>> > without changing any information, just forward it, that's all.<br>
>> ><br>
>> > I was used to send application message in binary as a Client, just<br>
>> > using gen_udp and gen_tcp, but now, I am not the Client. And not the<br>
>> > server because those messages are not for me neither.<br>
>> ><br>
>> > => Then, after I decapsulate these messages from GTP-U, I would like<br>
>> > to relay these layer messages to the Router with which I am connected.<br>
>> > The Router should connect with me with one network interface, using<br>
>> > the same netmask, let's say a small /30 netmask, it's obvious.<br>
>> ><br>
>> > The IP addresses (src and dst) in the payload are not "from" me and<br>
>> > not "for" me.<br>
>> > Any tips please?<br>
>> ><br>
>> > Thank you,<br>
>> > Best Regards,<br>
>> ><br>
>><br>
><br>
><br>
> --<br>
><br>
> Andreas Schultz<br>
><br>
> --<br>
><br>
> Principal Engineer<br>
><br>
> t: +49 391 819099-224<br>
><br>
> ------------------------------- enabling your networks<br>
> -----------------------------<br>
><br>
> Travelping GmbH<br>
> Roentgenstraße 13<br>
> 39108 Magdeburg<br>
> Germany<br>
><br>
> t: +49 391 819099-0<br>
> f: +49 391 819099-299<br>
><br>
> e: <a href="mailto:info@travelping.com" target="_blank">info@travelping.com</a><br>
> w: <a href="https://www.travelping.com/" rel="noreferrer" target="_blank">https://www.travelping.com/</a><br>
> Company registration: Amtsgericht Stendal<br>
> Managing Director: Holger Winkelmann<br>
> Reg. No.: HRB 10578<br>
> VAT ID: DE236673780<br>
><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><p><span style="font-family:verdana,geneva,sans-serif;font-size:10pt">Andreas Schultz</span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:10pt">-- </span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">Principal Engineer</span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:10.6667px"> t: +49 391 819099-224 </span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:8pt"><span style="font-family:verdana,geneva,sans-serif;font-size:10.6667px"></span></span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">------------------------------- enabling your networks -----------------------------</span></p>
<table style="height:142px;width:550px">
<tbody>
<tr style="height:30px">
<td style="width:146px;height:30px">
<p><span style="font-family:verdana,geneva,sans-serif;color:rgb(34,34,34);font-size:8pt">Travelping GmbH <br></span><span style="font-family:verdana,geneva,sans-serif;color:rgb(34,34,34);font-size:8pt">Roentgenstraße 13<br></span><span style="font-family:verdana,geneva,sans-serif;color:rgb(34,34,34);font-size:8pt">39108 Magdeburg<br></span><span style="font-family:verdana,geneva,sans-serif;color:rgb(34,34,34);font-size:8pt">Germany<br><br></span></p>
</td>
<td style="width:162px;height:30px">
<p style="color:rgb(34,34,34);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:small;text-align:justify"><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">t: +49 391 819099-0<br></span><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">f: +49 391 819099-299</span></p>
<p style="color:rgb(34,34,34);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:small;text-align:justify"><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">e: <a href="mailto:info@travelping.com" target="_blank">info@travelping.com</a><br></span><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">w: <a href="https://www.travelping.com/" target="_blank">https://www.travelping.com/</a></span></p>
</td>
</tr>
<tr style="height:17px">
<td style="width:146px;height:17px"><span style="font-size:8pt;font-family:verdana,geneva,sans-serif">Company registration: Amtsgericht Stendal <br>Managing Director: Holger Winkelmann<br></span></td>
<td style="width:162px;height:17px"><span style="font-size:8pt;font-family:verdana,geneva,sans-serif">Reg. No.: HRB 10578<br>VAT ID: DE236673780</span></td>
</tr>
</tbody>
</table></div></div>