OsmoGGSN attempts to use the same GTP-U socket for all APNs with gtpu-mode kernel-gtp
Currently it is not possible to configure multiple APNs with gtpu-mode kernel-gtp in OsmoGGSN. When attempting to do so:
tun.c:213 cannot create GTP tunnel device: Device or resource busy
laforge wrote in https://osmocom.org/issues/6096#note-9:
On Thu, Jul 20, 2023 at 01:35:30PM +0000, osmith wrote:
As I understand it, the problem is that we pass the same gsn->fd0 and gsn->fd10 to gtp_kernel_create in lib/tun.c:tun_new().
Ah. Ok, that explains. The way how the kernel GTP driver works is that for each UDP socket there can only be one gtp-net-device. After all, the kernel and all of GTP-U know nothing about APNs. All they know is packets arriving, and TEID-to-IP address mappings.
This means, indeed, for every UDP socket, there can only be one APN configured. However, multiple different
UDP sockets can serve multiple APNs. The way how GTP-C vs GTP-U works, one can actually hand out a different GTP-U endpoint/socket/port for each PDP context that is being activated. So osmo-ggsn could create one different GTP-U socket for each APN, and then hand out the respective GTP-U IP address during PDP context activate.