aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-01-07 16:01:09 +0100
committerHarald Welte <laforge@gnumonks.org>2017-01-08 16:04:01 +0100
commita32c769bb7c71c71376cfb934082c07272cfe0c3 (patch)
tree0b1ab71ef46ec28d5d6cbde2f4fcc55979064929
parenta115fbb1bbfeec9c6a10ac2ea2999e23be77336a (diff)
Generate GSMTAP messages from raw received DIAG frames
This forwards the raw DIAG messages via GSMTAP, so the receiver (e.g. wireshark) will have to do a full DIAG protocol decode. I currently prefer this idea to that of converting only the protocol payload to "native" GSMTAP messages like GSMTAP_UM. One of the problems is that the LAPDm headers are alrady stripped, and we would have to re-add fake LAPDm headers to generate GSMTAP_UM. So let's rather forward all information we have and let wireshark deal with it. I'm not entirely sure if this is the best strategy, but we can always implement both modes and switch between them at runtime.
-rw-r--r--src/diag_io.c15
-rw-r--r--src/diag_io.h1
-rw-r--r--src/osmo-qcdiag-log.c1
3 files changed, 17 insertions, 0 deletions
diff --git a/src/diag_io.c b/src/diag_io.c
index 9309774..46af445 100644
--- a/src/diag_io.c
+++ b/src/diag_io.c
@@ -23,6 +23,9 @@
#include <string.h>
#include <unistd.h>
+#include <osmocom/core/gsmtap.h>
+#include <osmocom/core/gsmtap_util.h>
+
#include "protocol/protocol.h"
#include "diag_io.h"
#include "diag_cmd.h"
@@ -45,6 +48,11 @@ int diag_transmit_msgb(struct diag_instance *di, struct msgb *msg)
struct diag_send_desc_type send;
struct diag_hdlc_dest_type enc = { NULL, NULL, 0 };
+ if (di->flags & DIAG_INST_F_GSMTAP_DIAG && di->gsmtap) {
+ gsmtap_send_ex(di->gsmtap, GSMTAP_TYPE_QC_DIAG, 0, 0, 0,
+ 0, 0, 0, 0, msgb_l2(msg), msgb_l2len(msg));
+ }
+
if (di->flags & DIAG_INST_F_HEXDUMP)
printf("Tx: %s\n", msgb_hexdump(msg));
@@ -146,6 +154,13 @@ struct msgb *diag_read_msg(struct diag_instance *di)
if (di->flags & DIAG_INST_F_HEXDUMP)
printf("Rx: %s\n", msgb_hexdump(msg));
+ if (di->flags & DIAG_INST_F_GSMTAP_DIAG && di->gsmtap) {
+ gsmtap_send_ex(di->gsmtap, GSMTAP_TYPE_QC_DIAG,
+ GSMTAP_ARFCN_F_UPLINK, 0, 0, 0,
+ 0, 0, 0, msgb_l2(msg),
+ msgb_l2len(msg));
+ }
+
return msg;
}
diff --git a/src/diag_io.h b/src/diag_io.h
index 1e6d662..d3fd64e 100644
--- a/src/diag_io.h
+++ b/src/diag_io.h
@@ -5,6 +5,7 @@
#include <osmocom/core/gsmtap_util.h>
#define DIAG_INST_F_HEXDUMP 0x00000001
+#define DIAG_INST_F_GSMTAP_DIAG 0x00000002
struct diag_instance {
int fd;
diff --git a/src/osmo-qcdiag-log.c b/src/osmo-qcdiag-log.c
index 8905576..33b26ba 100644
--- a/src/osmo-qcdiag-log.c
+++ b/src/osmo-qcdiag-log.c
@@ -160,6 +160,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
di.gsmtap = gsmtap_source_init("localhost", GSMTAP_UDP_PORT, 0);
+ di.flags = DIAG_INST_F_GSMTAP_DIAG;
gsmtap_source_add_sink(di.gsmtap);
printf("\n===> CONFIGURING\n");