gtp-kernel: Re-add support for kernel GTP-U acceleration

When we branched off osmo-ggsn from the old openggsn code base, the
support for kernel-gtp got temporarily removed.  This patch
re-introduces support for handling the GTP-U plane in the Linux kernel
by means of libgtpnl + the kernel GTP-U driver.

This only works for IPv4 at the moment, until the kernel GTP-U code
gains IPv6 support.

Kernel GTP currently also is restricted to a single APN per GSN.

Change-Id: Ieb1bc1bd0d51d41947f0abd6ebbc2e5d102592d6
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 4af044e..2937b04 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -259,12 +259,16 @@
 		apn->tun.tun->priv = apn;
 		break;
 	case APN_GTPU_MODE_KERNEL_GTP:
-		LOGPAPN(LOGL_ERROR, apn, "FIXME: Kernel GTP\n");
-#if 0
+		if (apn->cfg.apn_type_mask & (APN_TYPE_IPv6|APN_TYPE_IPv4v6)) {
+			LOGPAPN(LOGL_ERROR, apn, "Kernel GTP currently supports only IPv4\n");
+			apn_stop(apn, false);
+			return -1;
+		}
+		LOGPAPN(LOGL_ERROR, apn, "Setting up Kernel GTP\n");
 		/* use GTP kernel module for data packet encapsulation */
-		if (gtp_kernel_init(gsn, &net.v4, prefixlen, net_arg) < 0)
-			goto err;
-#endif
+		if (gtp_kernel_init(apn->ggsn->gsn, &apn->v4.cfg.ifconfig_prefix, apn->tun.cfg.ipup_script) < 0) {
+			return -1;
+		}
 		break;
 	default:
 		LOGPAPN(LOGL_ERROR, apn, "Unknown GTPU Mode %d\n", apn->cfg.gtpu_mode);