Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTP-U traffic #290

Closed
aprilsmith opened this issue Sep 30, 2019 · 2 comments
Closed

GTP-U traffic #290

aprilsmith opened this issue Sep 30, 2019 · 2 comments

Comments

@aprilsmith
Copy link

aprilsmith commented Sep 30, 2019

Dear Project Leader,

I'm interested in the control and user plane messages dump sent and received between core network entities
Data transfer test between srsLTE(srsEnB, srsUE) and NextEPC by configuring the FTP server on the NextEPC instlled PC have gone as planned.

To classify only GTP-U traffic, I try to dump the packet in sendbuf(pgw-gtp-path.c), but there is no raw data identical to that of wireshark.
GTP-U data might be delivered from sendbuf(pgw-gtp-path.c) to pktbuf(gtp-path.c) via gtp_sendto function
But using the ogs_log_hexdump, the contents of sendbuf-> data and pktbuf-> data looks like different in same condition.

Only pktbuf in gtp-path.c has the same data as wireshark's GPRS protocol raw data.
But pktbuf contains all GTP datas, so it is not easy to select GTP-U only.
(Packets beginning with 30ff003e00000002 are only in pktbuf)

int gtp_sendto(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf)
{
    ssize_t sent;
    ogs_sock_t *sock = NULL;
    ogs_sockaddr_t *conn = NULL;

    ogs_assert(gnode);
    ogs_assert(pkbuf);
    sock = gnode->sock;
    ogs_assert(sock);
    conn = &gnode->conn;
    ogs_assert(conn);
//////////////////////	
	ogs_log_print(OGS_LOG_INFO, "[TEST-gtp-path.c] gtp_sendto\n");
	ogs_info("pkbuf->len : %d", pkbuf->len);
	ogs_log_hexdump(OGS_LOG_INFO, pkbuf->data,pkbuf->len); 
//////////////////////
    sent = ogs_sendto(sock->fd, pkbuf->data, pkbuf->len, 0, conn);

In summary,

  1. How can I distinguish between GTP-C and GTP-U in your program?
    (What's the difference between sendbuf and pktbuf)
  2. Please let me konw that how to dump data between core entities including pgw-sgw.

Refer to the attached log and thanks in advance.

gtpu.zip

@acetcom
Copy link
Member

acetcom commented Sep 30, 2019

Hi @aprilsmith,

The following is my modification.

diff --git a/lib/gtp/path.c b/lib/gtp/path.c
index 4ca43d76..0acf6fda 100644
--- a/lib/gtp/path.c
+++ b/lib/gtp/path.c
@@ -134,6 +134,8 @@ int ogs_gtp_sendto(ogs_gtp_node_t *gnode, ogs_pkbuf_t *pkbuf)
     conn = &gnode->conn;
     ogs_assert(conn);
 
+    ogs_info("ogs_gtp_sendto()");
+    ogs_log_hexdump(OGS_LOG_INFO, pkbuf->data, pkbuf->len);
     sent = ogs_sendto(sock->fd, pkbuf->data, pkbuf->len, 0, conn);
     if (sent < 0 || sent != pkbuf->len) {
         ogs_error("ogs_send() failed");
diff --git a/src/pgw/pgw-gtp-path.c b/src/pgw/pgw-gtp-path.c
index a704cba2..e9284089 100644
--- a/src/pgw/pgw-gtp-path.c
+++ b/src/pgw/pgw-gtp-path.c
@@ -415,6 +415,8 @@ static int pgw_gtp_send_to_bearer(pgw_bearer_t *bearer, ogs_pkbuf_t *sendbuf)
     ogs_debug("[PGW] SEND GPU-U to SGW[%s] : TEID[0x%x]",
         OGS_ADDR(&bearer->gnode->conn, buf),
         bearer->sgw_s5u_teid);
+    ogs_info("pgw_gtp_send_to_bearer()");
+    ogs_log_hexdump(OGS_LOG_INFO, sendbuf->data, sendbuf->len);
     rv =  ogs_gtp_sendto(bearer->gnode, sendbuf);

And then, I did run a simulator using testsimple program.

$ ./test/testsimple

...
09/30 20:49:10.194: [pgw] DEBUG: [PGW] SEND GPU-U to SGW[127.0.0.2] : TEID[0x2] (pgw-gtp-path.c:417)
09/30 20:49:10.194: [pgw] INFO: pgw_gtp_send_to_bearer() (pgw-gtp-path.c:418)
0000: 30ff001c 00000002 4500001c 3e420000   0.......E...>B..
0010: 4001e242 2d2d0001 2d2d0002 0000129f   @..B--..--......
0020: fb1ef241                              ...A
09/30 20:49:10.194: [gtp] INFO: ogs_gtp_sendto() (path.c:137)
0000: 30ff001c 00000002 4500001c 3e420000   0.......E...>B..
0010: 4001e242 2d2d0001 2d2d0002 0000129f   @..B--..--......
0020: fb1ef241                              ...A
09/30 20:49:10.194: [sgw] DEBUG: [SGW] RECV GPU-U from [127.0.0.3] : TEID[0x2] (sgw-gtp-path.c:125)
09/30 20:49:10.194: [sgw] DEBUG: [SGW] SEND GPU-U to ENB[127.0.0.5]: TEID[0x1] (sgw-gtp-path.c:186)
09/30 20:49:10.194: [gtp] INFO: ogs_gtp_sendto() (path.c:137)
0000: 30ff001c 00000001 4500001c 3e420000   0.......E...>B..
0010: 4001e242 2d2d0001 2d2d0002 0000129f   @..B--..--......
0020: fb1ef241                              ...A
-09/30 20:49:10.194: [mme] DEBUG: SCTP_SHUTDOWN_EVENT:[T:32773, F:0x0, L:12] (s1ap-lkpath.c:147)
...

It looks fine for me.

Thanks!

@aprilsmith
Copy link
Author

Thanks for your cooperation and sorry for the late reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants