gtp: provide interface to set family
Kernel now supports for TID/I_TEI to be used in both IPv4 and IPv6 GTP
tunnels. This improves dualstack support for MS/UE so GTP traffic can
be identified with the same tunnel identifier.
Update gtp-tunnel to specify the family, since a tunnel is now
identified by the following tuple [ version, identifier, family ].
Change-Id: I584d3997ffb89cd430dfda9615a4ce0ce517ab2a
diff --git a/tools/gtp-tunnel.c b/tools/gtp-tunnel.c
index 1fcdee7..1b8a7a0 100644
--- a/tools/gtp-tunnel.c
+++ b/tools/gtp-tunnel.c
@@ -131,8 +131,8 @@
struct gtp_tunnel *t;
uint32_t gtp_ifidx;
- if (argc != 5) {
- printf("%s del <gtp device> <version> <tid>\n",
+ if (argc != 6) {
+ printf("%s del <gtp device> <version> <tid> <family>\n",
argv[0]);
return EXIT_FAILURE;
}
@@ -160,6 +160,16 @@
return EXIT_FAILURE;
}
+ if (strcmp(argv[5], "ip") == 0) {
+ gtp_tunnel_set_family(t, AF_INET);
+ } else if (strcmp(argv[5], "ip6") == 0) {
+ gtp_tunnel_set_family(t, AF_INET6);
+ } else {
+ fprintf(stderr, "wrong family %s, use ip or ip6\n", argv[5]);
+ gtp_tunnel_free(t);
+ return EXIT_FAILURE;
+ }
+
gtp_del_tunnel(genl_id, nl, t);
gtp_tunnel_free(t);