On 19 Feb 2016, at 19:20, msuraev@sysmocom.de wrote:
From: Max <msuraev@sysmocom.de>
his 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.
great. Have you checked that the osmo-pcu for the sysmoBTS behaves as before?
-/* FIXME: finally get some option parsing code into libosmocore */ +/* FIXME: finally try using gengetopt */
this is a different question. What I have seen in the OpenGGSN did not impress me. Now your patch is blocked by something that has nothing to do with gsmtap. ;)
static void handle_options(int argc, char **argv) { while (1) { @@ -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; @@ -212,6 +220,14 @@ 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); + }
coding style, please drop the curly braces. The rest does look fine.