aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-02-22 11:39:30 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-02-22 14:00:17 +0100
commit2efdf69734dc8d7f0953caad1563552f53c47b06 (patch)
treeebae76ede625d173c373946b83dc02214a851246
parent9d5580b6dd8069dbb5cdfa00b65f73978f580bcc (diff)
Introduce --gsmtap-ip/-i option
This option allows user to use custom IP address instead of default "localhost". Correspondingly gsmtap init moved from sysmoBTS-specific code up to "bts" struct level. This way it can be easier reused by other implementations. The lack of regressions was verified by checking following command on sysmoBTS: "./osmo-pcu -c osmo-pcu.cfg -r 1 -i 192.168.10.1" where 192.168.10.1 is the host which was running wireshark and netcat: "nc -u -l 192.168.10.1 -p 4729" to accept gsmtap flow.
-rw-r--r--src/bts.h2
-rw-r--r--src/pcu_l1_if.cpp5
-rw-r--r--src/pcu_main.cpp17
-rw-r--r--src/sysmo_l1_if.c6
4 files changed, 23 insertions, 7 deletions
diff --git a/src/bts.h b/src/bts.h
index 119f6b2c..c9753041 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -27,6 +27,7 @@ extern "C" {
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/stat_item.h>
#include <osmocom/core/timer.h>
+#include <osmocom/core/gsmtap.h>
}
#include "poll_controller.h"
@@ -172,6 +173,7 @@ struct gprs_rlcmac_bts {
uint8_t n3101;
uint8_t n3103;
uint8_t n3105;
+ struct gsmtap_inst *gsmtap;
struct gprs_rlcmac_trx trx[8];
int (*alloc_algorithm)(struct gprs_rlcmac_bts *bts,
struct GprsMs *ms,
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 9d7dbee5..e816e6f3 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -42,7 +42,7 @@ extern "C" {
// FIXME: move this, when changed from c++ to c.
extern "C" {
-void *l1if_open_pdch(void *priv, uint32_t hlayer1);
+void *l1if_open_pdch(void *priv, uint32_t hlayer1, struct gsmtap_inst *gsmtap);
int l1if_connect_pdch(void *obj, uint8_t ts);
int l1if_pdch_req(void *obj, uint8_t ts, int is_ptcch, uint32_t fn,
uint16_t arfcn, uint8_t block_nr, uint8_t *data, uint8_t len);
@@ -436,7 +436,8 @@ bssgp_failed:
if (!bts->trx[trx].fl1h)
bts->trx[trx].fl1h = l1if_open_pdch(
(void *)trx,
- info_ind->trx[trx].hlayer1);
+ info_ind->trx[trx].hlayer1,
+ bts->gsmtap);
if (!bts->trx[trx].fl1h) {
LOGP(DL1IF, LOGL_FATAL, "Failed to open direct "
"DSP access for PDCH.\n");
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index 8eb7441a..4126d063 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -33,6 +33,8 @@ extern "C" {
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/logging.h>
#include <osmocom/core/stats.h>
+#include <osmocom/core/gsmtap.h>
+#include <osmocom/core/gsmtap_util.h>
}
extern struct gprs_nsvc *nsvc;
@@ -44,6 +46,7 @@ void *tall_pcu_ctx;
extern void *bv_tall_ctx;
static int quit = 0;
static int rt_prio = -1;
+static char *gsmtap_addr = "localhost"; // FIXME: use gengetopt's default value instead
static void print_help()
{
@@ -58,6 +61,7 @@ static void print_help()
" -V --version print version\n"
" -r --realtime PRIO Use SCHED_RR with the specified "
"priority\n"
+ " -i --gsmtap-ip The destination IP used for GSMTAP.\n"
);
}
@@ -74,10 +78,11 @@ static void handle_options(int argc, char **argv)
{ "version", 0, 0, 'V' },
{ "realtime", 1, 0, 'r' },
{ "exit", 0, 0, 'e' },
+ { "gsmtap-ip", 1, 0, 'i' },
{ 0, 0, 0, 0 }
};
- c = getopt_long(argc, argv, "hc:m:n:Vr:e",
+ c = getopt_long(argc, argv, "hc:m:n:Vr:e:i:",
long_options, &option_idx);
if (c == -1)
break;
@@ -102,6 +107,9 @@ static void handle_options(int argc, char **argv)
print_version(1);
exit(0);
break;
+ case 'i':
+ gsmtap_addr = optarg;
+ break;
case 'r':
rt_prio = atoi(optarg);
break;
@@ -219,6 +227,13 @@ int main(int argc, char *argv[])
exit(0);
}
+ bts->gsmtap = gsmtap_source_init(gsmtap_addr, GSMTAP_UDP_PORT, 1);
+
+ if (bts->gsmtap)
+ gsmtap_source_add_sink(bts->gsmtap);
+ else
+ fprintf(stderr, "Failed to initialize GSMTAP for %s\n", gsmtap_addr);
+
rc = vty_read_config_file(config_file, NULL);
if (rc < 0 && config_given) {
fprintf(stderr, "Failed to parse the config file: '%s'\n",
diff --git a/src/sysmo_l1_if.c b/src/sysmo_l1_if.c
index 85727861..c7c54dd9 100644
--- a/src/sysmo_l1_if.c
+++ b/src/sysmo_l1_if.c
@@ -357,7 +357,7 @@ int l1if_pdch_req(void *obj, uint8_t ts, int is_ptcch, uint32_t fn,
return 0;
}
-void *l1if_open_pdch(void *priv, uint32_t hlayer1)
+void *l1if_open_pdch(void *priv, uint32_t hlayer1, struct gsmtap_inst *gsmtap)
{
struct femtol1_hdl *fl1h;
int rc;
@@ -378,9 +378,7 @@ void *l1if_open_pdch(void *priv, uint32_t hlayer1)
return NULL;
}
- fl1h->gsmtap = gsmtap_source_init("localhost", GSMTAP_UDP_PORT, 1);
- if (fl1h->gsmtap)
- gsmtap_source_add_sink(fl1h->gsmtap);
+ fl1h->gsmtap = gsmtap;
return fl1h;
}