Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11472 )

Change subject: trxcon: make TRX bind address configurable
......................................................................

trxcon: make TRX bind address configurable

Previously the wildcard address (i.e. '0.0.0.0') was hard-coded
as the bind address of TRX interface. Let's make it configurable
by introducing a command line option.

Note that the '--trx-ip' option was deprecated by '--trx-remote',
because it isn't clean whether it is remore or local address. It
still can be used, but was removed from help message.

Change-Id: Ic2f43632cc57bb6f722eba05219e438f97fecb95
---
M src/host/trxcon/trxcon.c
1 file changed, 17 insertions(+), 6 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Max: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c
index 84d132e..251321d 100644
--- a/src/host/trxcon/trxcon.c
+++ b/src/host/trxcon/trxcon.c
@@ -68,7 +68,8 @@

        /* TRX specific */
        struct trx_instance *trx;
-       const char *trx_ip;
+       const char *trx_bind_ip;
+       const char *trx_remote_ip;
        uint16_t trx_base_port;
        uint32_t trx_fn_advance;
 } app_data;
@@ -152,7 +153,8 @@
        printf(" Some help...\n");
        printf("  -h --help         this text\n");
        printf("  -d --debug        Change debug flags. Default: %s\n", 
DEBUG_DEFAULT);
-       printf("  -i --trx-ip       IP address of host runing TRX (default 
127.0.0.1)\n");
+       printf("  -b --trx-bind     TRX bind IP address (default 0.0.0.0)\n");
+       printf("  -i --trx-remote   TRX remote IP address (default 
127.0.0.1)\n");
        printf("  -p --trx-port     Base port of TRX instance (default 
6700)\n");
        printf("  -f --trx-advance  Scheduler clock advance (default 20)\n");
        printf("  -s --socket       Listening socket for layer23 (default 
/tmp/osmocom_l2)\n");
@@ -167,14 +169,18 @@
                        {"help", 0, 0, 'h'},
                        {"debug", 1, 0, 'd'},
                        {"socket", 1, 0, 's'},
+                       {"trx-bind", 1, 0, 'b'},
+                       /* NOTE: 'trx-ip' is now an alias for 'trx-remote'
+                        * due to backward compatibility reasons! */
                        {"trx-ip", 1, 0, 'i'},
+                       {"trx-remote", 1, 0, 'i'},
                        {"trx-port", 1, 0, 'p'},
                        {"trx-advance", 1, 0, 'f'},
                        {"daemonize", 0, 0, 'D'},
                        {0, 0, 0, 0}
                };

-               c = getopt_long(argc, argv, "d:i:p:f:s:Dh",
+               c = getopt_long(argc, argv, "d:b:i:p:f:s:Dh",
                                long_options, &option_index);
                if (c == -1)
                        break;
@@ -188,8 +194,11 @@
                case 'd':
                        app_data.debug_mask = optarg;
                        break;
+               case 'b':
+                       app_data.trx_bind_ip = optarg;
+                       break;
                case 'i':
-                       app_data.trx_ip = optarg;
+                       app_data.trx_remote_ip = optarg;
                        break;
                case 'p':
                        app_data.trx_base_port = atoi(optarg);
@@ -212,7 +221,8 @@
 static void init_defaults(void)
 {
        app_data.bind_socket = "/tmp/osmocom_l2";
-       app_data.trx_ip = "127.0.0.1";
+       app_data.trx_remote_ip = "127.0.0.1";
+       app_data.trx_bind_ip = "0.0.0.0";
        app_data.trx_base_port = 6700;
        app_data.trx_fn_advance = 20;

@@ -274,7 +284,8 @@
                goto exit;

        /* Init transceiver interface */
-       rc = trx_if_open(&app_data.trx, "0.0.0.0", app_data.trx_ip, 
app_data.trx_base_port);
+       rc = trx_if_open(&app_data.trx,
+               app_data.trx_bind_ip, app_data.trx_remote_ip, 
app_data.trx_base_port);
        if (rc)
                goto exit;


--
To view, visit https://gerrit.osmocom.org/11472
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2f43632cc57bb6f722eba05219e438f97fecb95
Gerrit-Change-Number: 11472
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>

Reply via email to