Sponsored-by: On-Waves ehi
---
 openbsc/src/gprs/gtphub.c      | 19 +++++++++++++++++--
 openbsc/src/gprs/gtphub_main.c |  1 +
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index c6ce4f6..5d7b63d 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -97,13 +97,14 @@ int validate_gtp0_header(const uint8_t *data, int data_len)
                return GTPH_TOOSHORT;
        }

+       LOG("GTP v0 TID = %" PRIu64 "\n", pheader->tid);
        return GTPH_V0;
 }

 int validate_gtp1_header(const uint8_t *data, int data_len)
 {
-       struct gtp1_header_short *pheader;
-       pheader = (struct gtp1_header_short *)data;
+       struct gtp1_header_long *pheader;
+       pheader = (struct gtp1_header_long *)data;

        OSMO_ASSERT(data_len >= 1);

@@ -129,6 +130,18 @@ int validate_gtp1_header(const uint8_t *data, int data_len)
                return GTPH_TOOSHORT;
        }

+       LOG("GTP v1 type = %" PRIu8 " 0x%02" PRIx8 "\n",
+           pheader->type, pheader->type);
+       LOG("GTP v1 length = %" PRIu16 " 0x%04" PRIx16 "\n",
+           ntoh16(pheader->length), ntoh16(pheader->length));
+       LOG("GTP v1 TEI = %" PRIu32 " 0x%08" PRIx32 "\n",
+           ntoh32(pheader->tei), ntoh32(pheader->tei));
+       LOG("GTP v1 seq = %" PRIu16 " 0x%04" PRIx16 "\n",
+           ntoh16(pheader->seq), ntoh16(pheader->seq));
+       LOG("GTP v1 npdu = %" PRIu8 " 0x%02" PRIx8 "\n",
+           pheader->npdu, pheader->npdu);
+       LOG("GTP v1 next = %" PRIu8 " 0x%02" PRIx8 "\n",
+           pheader->next, pheader->next);
        return GTPH_V1;
 }

@@ -329,6 +342,8 @@ static int gtp_relay(struct osmo_fd *from,

        /* insert magic here */

+       LOG("DATA\n%s\n", osmo_hexdump(buf, received));
+
        int gtph = validate_gtp_header(buf, received);

        if (gtph >= 0)
diff --git a/openbsc/src/gprs/gtphub_main.c b/openbsc/src/gprs/gtphub_main.c
index 104cbfd..b584617 100644
--- a/openbsc/src/gprs/gtphub_main.c
+++ b/openbsc/src/gprs/gtphub_main.c
@@ -199,6 +199,7 @@ int main(int argc, char **argv)
                LOGERR("Cannot resolve '%s port %d'\n", server_addr_str, 
server_port);
                exit(-1);
        }
+       LOG("DEBUG: using GTP server %s port %d\n", server_addr_str, 
server_port);

        log_cfg(cfg);

-- 
2.1.4

Reply via email to