diff options
Diffstat (limited to 'tools/gtp-link.c')
-rw-r--r-- | tools/gtp-link.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/gtp-link.c b/tools/gtp-link.c index 97dfa45..8367c6e 100644 --- a/tools/gtp-link.c +++ b/tools/gtp-link.c @@ -43,9 +43,9 @@ int main(int argc, char *argv[]) { char buf[MNL_SOCKET_BUFFER_SIZE]; - int ret; + int ret, sgsn_mode = 0; - if (argc != 3) { + if (argc < 3) { printf("Usage: %s <add|del> <device>\n", argv[0]); exit(EXIT_FAILURE); } @@ -58,6 +58,9 @@ int main(int argc, char *argv[]) return 0; } + if (argc > 3 && !strcmp(argv[3], "--sgsn")) + sgsn_mode = 1; + int fd1 = socket(AF_INET, SOCK_DGRAM, 0); int fd2 = socket(AF_INET, SOCK_DGRAM, 0); struct sockaddr_in sockaddr_fd1 = { @@ -86,7 +89,10 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - ret = gtp_dev_create(-1, argv[2], fd1, fd2); + if (sgsn_mode) + ret = gtp_dev_create_sgsn(-1, argv[2], fd1, fd2); + else + ret = gtp_dev_create(-1, argv[2], fd1, fd2); if (ret < 0) { perror("cannot create GTP device\n"); exit(EXIT_FAILURE); |